From 6e33d661788e7ec2d0ad64c46cb98af99197c065 Mon Sep 17 00:00:00 2001 From: Jaleel Bennett Date: Tue, 21 May 2024 20:58:22 -0400 Subject: [PATCH] feat: remove hook instances utility function --- internal/utils.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/utils.go b/internal/utils.go index ef82599..363e905 100644 --- a/internal/utils.go +++ b/internal/utils.go @@ -2,6 +2,7 @@ package internal import ( "fmt" + "os" "os/exec" "path/filepath" "strconv" @@ -61,4 +62,15 @@ func ExecuteCommand(command string, args ...string) (string, error) { return "", fmt.Errorf("failed to execute command: %w", err) } return strings.TrimSpace(string(output)), nil -} \ No newline at end of file +} + +func RemoveGitHooks(hookPath string) error { + hooks := []string{"commit-msg", "post-checkout"} + for _, hook := range hooks { + hookFile := filepath.Join(hookPath, hook) + if err := os.Remove(hookFile); err != nil { + return fmt.Errorf("failed to remove %s: %w", hook, err) + } + } + return nil +}