Skip to content

Commit 03b4770

Browse files
committed
chore(hook): Refactor Git hook and improve error handling
- Refactor git.Hook() to use git.New() for better testing - Replace usage of `file.IsFile` with `!os.IsNotExist` for better error handling
1 parent 0aa21f3 commit 03b4770

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hook/hook.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ func init() {
2828
}
2929

3030
func Install() error {
31-
hookPath, err := git.Hook()
31+
g := git.New()
32+
hookPath, err := g.HookPath()
3233
if err != nil {
3334
return err
3435
}
@@ -47,7 +48,8 @@ func Install() error {
4748
}
4849

4950
func Uninstall() error {
50-
hookPath, err := git.Hook()
51+
g := git.New()
52+
hookPath, err := g.HookPath()
5153
if err != nil {
5254
return err
5355
}

0 commit comments

Comments
 (0)