summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-02-21 15:01:48 +0800
committerGitHub <noreply@github.com>2024-02-21 07:01:48 +0000
commit7f45dfb030f30a3ada58e636e3b8bfde391224bd (patch)
tree11cd61ec4ed266c75d9750bedcfc8ea37c1f5cea
parent22b8de85ddda50725480b21c5bf6ef9c0202b5e9 (diff)
downloadgitea-7f45dfb030f30a3ada58e636e3b8bfde391224bd.tar.gz
gitea-7f45dfb030f30a3ada58e636e3b8bfde391224bd.zip
Always write proc-receive hook for all git versions (#29287)
-rw-r--r--modules/repository/hooks.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/repository/hooks.go b/modules/repository/hooks.go
index daab7c3091..95849789ab 100644
--- a/modules/repository/hooks.go
+++ b/modules/repository/hooks.go
@@ -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
}