@@ -976,7 +976,7 @@ func createDelegateHooks(repoPath string) (err error) {
976976 }
977977 giteaHookTpls = []string {
978978 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+ "" ,
980980 fmt .Sprintf ("#!/usr/bin/env %s\n \" %s\" hook --config='%s' post-receive\n " , setting .ScriptType , setting .AppPath , setting .CustomConf ),
981981 }
982982 )
@@ -996,11 +996,20 @@ func createDelegateHooks(repoPath string) (err error) {
996996 return fmt .Errorf ("write old hook file '%s': %v" , oldHookPath , err )
997997 }
998998
999+ if len (giteaHookTpls [i ]) == 0 {
1000+ continue
1001+ }
9991002 if err = ioutil .WriteFile (newHookPath , []byte (giteaHookTpls [i ]), 0777 ); err != nil {
10001003 return fmt .Errorf ("write new hook file '%s': %v" , newHookPath , err )
10011004 }
10021005 }
10031006
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+
10041013 return nil
10051014}
10061015
0 commit comments