]> source.dussan.org Git - gitea.git/commitdiff
Always write proc-receive hook for all git versions (#29287)
authorwxiaoguang <wxiaoguang@gmail.com>
Wed, 21 Feb 2024 07:01:48 +0000 (15:01 +0800)
committerGitHub <noreply@github.com>
Wed, 21 Feb 2024 07:01:48 +0000 (07:01 +0000)
modules/repository/hooks.go

index daab7c3091ebe2ec686505fce0f363eec3ad449f..95849789ab1f905b0fbe71c9970a4052586ac9e4 100644 (file)
@@ -9,7 +9,6 @@ import (
        "path/filepath"
        "runtime"
 
-       "code.gitea.io/gitea/modules/git"
        "code.gitea.io/gitea/modules/setting"
        "code.gitea.io/gitea/modules/util"
 )
@@ -94,15 +93,14 @@ done
 `, setting.ScriptType, util.ShellEscape(setting.AppPath), util.ShellEscape(setting.CustomConf)),
        }
 
-       if git.SupportProcReceive {
-               hookNames = append(hookNames, "proc-receive")
-               hookTpls = append(hookTpls,
-                       fmt.Sprintf(`#!/usr/bin/env %s
+       // although only new git (>=2.29) supports proc-receive, it's still good to create its hook, in case the user upgrades git
+       hookNames = append(hookNames, "proc-receive")
+       hookTpls = append(hookTpls,
+               fmt.Sprintf(`#!/usr/bin/env %s
 # AUTO GENERATED BY GITEA, DO NOT MODIFY
 %s hook --config=%s proc-receive
 `, setting.ScriptType, util.ShellEscape(setting.AppPath), util.ShellEscape(setting.CustomConf)))
-               giteaHookTpls = append(giteaHookTpls, "")
-       }
+       giteaHookTpls = append(giteaHookTpls, "")
 
        return hookNames, hookTpls, giteaHookTpls
 }