Пример #1
0
func installCommand(cmd *cobra.Command, args []string) {
	requireGitVersion()

	if localInstall {
		requireInRepo()
	}

	if systemInstall && os.Geteuid() != 0 {
		Print("WARNING: current user is not root/admin, system install is likely to fail.")
	}

	if localInstall && systemInstall {
		Exit("Only one of --local and --system options can be specified.")
	}

	opt := lfs.InstallOptions{Force: forceInstall, Local: localInstall, System: systemInstall}
	if skipSmudgeInstall {
		// assume the user is changing their smudge mode, so enable force implicitly
		opt.Force = true
	}

	if err := lfs.InstallFilters(opt, skipSmudgeInstall); err != nil {
		Error(err.Error())
		Exit("Run `git lfs install --force` to reset git config.")
	}

	if localInstall || lfs.InRepo() {
		installHooksCommand(cmd, args)
	}

	Print("Git LFS initialized.")
}
Пример #2
0
func uninstallCommand(cmd *cobra.Command, args []string) {
	if err := lfs.UninstallFilters(); err != nil {
		Error(err.Error())
	}

	Print("Global Git LFS configuration has been removed.")

	if lfs.InRepo() {
		uninstallHooksCommand(cmd, args)
	}
}
Пример #3
0
func initCommand(cmd *cobra.Command, args []string) {
	if err := lfs.InstallFilters(); err != nil {
		Error(err.Error())
	}

	if lfs.InRepo() {
		initHooksCommand(cmd, args)
	}

	Print("git lfs initialized")
}
Пример #4
0
func initCommand(cmd *cobra.Command, args []string) {
	if err := lfs.InstallFilters(forceInit); err != nil {
		Error(err.Error())
		Exit("Run `git lfs init --force` to reset git config.")
	}

	if lfs.InRepo() {
		initHooksCommand(cmd, args)
	}

	Print("Git LFS initialized.")
}
Пример #5
0
func initCommand(cmd *cobra.Command, args []string) {
	if localInit {
		requireInRepo()
	}

	opt := lfs.InstallOptions{Force: forceInit, Local: localInit}
	if skipSmudgeInit {
		// assume the user is changing their smudge mode, so enable force implicitly
		opt.Force = true
	}

	if err := lfs.InstallFilters(opt, skipSmudgeInit); err != nil {
		Error(err.Error())
		Exit("Run `git lfs init --force` to reset git config.")
	}

	if localInit || lfs.InRepo() {
		initHooksCommand(cmd, args)
	}

	Print("Git LFS initialized.")
}
Пример #6
0
func requireInRepo() {
	if !lfs.InRepo() {
		Print("Not in a git repository.")
		os.Exit(128)
	}
}