@@ -976,7 +976,7 @@ func createDelegateHooks(repoPath string) (err error) {
976
976
}
977
977
giteaHookTpls = []string {
978
978
fmt .Sprintf ("#!/usr/bin/env %s\n \" %s\" hook --config='%s' pre-receive\n " , setting .ScriptType , setting .AppPath , setting .CustomConf ),
979
- fmt . Sprintf ( "#!/usr/bin/env %s \n \" %s \" hook --config='%s' update $1 $2 $3 \n " , setting . ScriptType , setting . AppPath , setting . CustomConf ) ,
979
+ "" ,
980
980
fmt .Sprintf ("#!/usr/bin/env %s\n \" %s\" hook --config='%s' post-receive\n " , setting .ScriptType , setting .AppPath , setting .CustomConf ),
981
981
}
982
982
)
@@ -996,11 +996,20 @@ func createDelegateHooks(repoPath string) (err error) {
996
996
return fmt .Errorf ("write old hook file '%s': %v" , oldHookPath , err )
997
997
}
998
998
999
+ if len (giteaHookTpls [i ]) == 0 {
1000
+ continue
1001
+ }
999
1002
if err = ioutil .WriteFile (newHookPath , []byte (giteaHookTpls [i ]), 0777 ); err != nil {
1000
1003
return fmt .Errorf ("write new hook file '%s': %v" , newHookPath , err )
1001
1004
}
1002
1005
}
1003
1006
1007
+ // Remove the old unused update.d/gitea hook as it is empty
1008
+ newHookPath := filepath .Join (hookDir , "update.d" , "gitea" )
1009
+ if err := os .Remove (newHookPath ); err != nil && ! os .IsNotExist (err ) {
1010
+ return fmt .Errorf ("remove unused update hook file '%s': %v" , newHookPath , err )
1011
+ }
1012
+
1004
1013
return nil
1005
1014
}
1006
1015
0 commit comments