MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / gitRemoveHook

Function gitRemoveHook

internal/cmd/remove.go:18–39  ·  view source on GitHub ↗

gitRemoveHook removes commitlint from git config by unsetting core.hooksPath. It prompts for confirmation before making any changes. Hook files are left intact - the user can remove them manually if needed.

(isGlobal bool)

Source from the content-addressed store, hash-verified

16// It prompts for confirmation before making any changes.
17// Hook files are left intact - the user can remove them manually if needed.
18func gitRemoveHook(isGlobal bool) error {
19 scope := "local"
20 if isGlobal {
21 scope = "global"
22 }
23 confirmed, err := promptConfirm(fmt.Sprintf("Unset core.hooksPath from %s git config?", scope))
24 if err != nil {
25 return err
26 }
27 if !confirmed {
28 fmt.Println("aborted")
29 return nil
30 }
31
32 if err := unsetGitConf(isGlobal); err != nil {
33 return fmt.Errorf("could not unset git core.hooksPath: %w", err)
34 }
35
36 fmt.Println("commitlint hook removed successfully")
37 fmt.Println("note: hook files were not removed - delete them manually if no longer needed")
38 return nil
39}
40
41// unsetGitConf removes the core.hooksPath entry from git config (local or global).
42func unsetGitConf(isGlobal bool) error {

Callers 1

removeLintFunction · 0.85

Calls 2

promptConfirmFunction · 0.85
unsetGitConfFunction · 0.85

Tested by

no test coverage detected