forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command_uninstall.go
40 lines (33 loc) · 1.17 KB
/
command_uninstall.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package commands
import (
"github.com/git-lfs/git-lfs/lfs"
"github.com/git-lfs/git-lfs/localstorage"
"github.com/spf13/cobra"
)
// uninstallCmd removes any configuration and hooks set by Git LFS.
func uninstallCommand(cmd *cobra.Command, args []string) {
opt := cmdInstallOptions()
if err := lfs.UninstallFilters(opt); err != nil {
Error(err.Error())
}
if localInstall || lfs.InRepo() {
localstorage.InitStorageOrFail()
uninstallHooksCommand(cmd, args)
}
Print("Global Git LFS configuration has been removed.")
}
// uninstallHooksCmd removes any hooks created by Git LFS.
func uninstallHooksCommand(cmd *cobra.Command, args []string) {
if err := lfs.UninstallHooks(); err != nil {
Error(err.Error())
}
Print("Hooks for this repository have been removed.")
}
func init() {
RegisterCommand("uninstall", uninstallCommand, func(cmd *cobra.Command) {
cmd.Flags().BoolVarP(&localInstall, "local", "l", false, "Set the Git LFS config for the local Git repository only.")
cmd.Flags().BoolVarP(&systemInstall, "system", "", false, "Set the Git LFS config in system-wide scope.")
cmd.AddCommand(NewCommand("hooks", uninstallHooksCommand))
cmd.PreRun = setupLocalStorage
})
}