@@ -751,7 +751,7 @@ func installDotfiles(ctx context.Context, cfg *Config, tokenService *InMemoryTok
751751 }
752752
753753 // write some feedback to the terminal
754- out .WriteString (fmt .Sprintf ("# echo linking %s -> %s\n " , path , homeFN ))
754+ _ , _ = out .WriteString (fmt .Sprintf ("# echo linking %s -> %s\n " , path , homeFN ))
755755
756756 return os .Symlink (path , homeFN )
757757 })
@@ -810,7 +810,6 @@ func configureGit(cfg *Config) {
810810 {"alias.lg" , "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" },
811811 {"credential.helper" , "/usr/bin/gp credential-helper" },
812812 {"safe.directory" , "*" },
813- {"core.hooksPath" , "/etc/git/hooks" },
814813 }
815814 if cfg .GitUsername != "" {
816815 settings = append (settings , []string {"user.name" , cfg .GitUsername })
@@ -820,7 +819,7 @@ func configureGit(cfg *Config) {
820819 }
821820
822821 if cfg .CommitAnnotationEnabled {
823- err := setupGitMessageHook ()
822+ err := setupGitMessageHook (filepath . Join ( cfg . RepoRoot , ".git" , "hooks" ) )
824823 if err != nil {
825824 log .WithError (err ).Error ("cannot setup git message hook" )
826825 }
@@ -842,14 +841,13 @@ const hookContent = `#!/bin/sh
842841exec /usr/bin/gp git-commit-message-helper --file "$1"
843842`
844843
845- func setupGitMessageHook () error {
846- hookPath := "/etc/git/hooks"
847- if err := os .MkdirAll (hookPath , 0755 ); err != nil {
844+ func setupGitMessageHook (path string ) error {
845+ if err := os .MkdirAll (path , 0755 ); err != nil {
848846 return err
849847 }
850848
851- hookFile := filepath .Join (hookPath , "prepare-commit-msg" )
852- if err := os .WriteFile (hookFile , []byte (hookContent ), 0755 ); err != nil {
849+ fn := filepath .Join (path , "prepare-commit-msg" )
850+ if err := os .WriteFile (fn , []byte (hookContent ), 0755 ); err != nil {
853851 return err
854852 }
855853
0 commit comments