コード例 #1
0
ファイル: command_install.go プロジェクト: zhaohaiyi/git-lfs
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
ファイル: command_init.go プロジェクト: devcurmudgeon/git-lfs
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
ファイル: command_init.go プロジェクト: sanoursa/git-lfs
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
ファイル: command_init.go プロジェクト: rachid1985/git-lfs
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
ファイル: commands.go プロジェクト: tidatida/git-lfs
func requireInRepo() {
	if !lfs.InRepo() {
		Print("Not in a git repository.")
		os.Exit(128)
	}
}