Skip to content

Commit 7f45dfb

Browse files
authored
Always write proc-receive hook for all git versions (#29287)
1 parent 22b8de8 commit 7f45dfb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

modules/repository/hooks.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"path/filepath"
1010
"runtime"
1111

12-
"code.gitea.io/gitea/modules/git"
1312
"code.gitea.io/gitea/modules/setting"
1413
"code.gitea.io/gitea/modules/util"
1514
)
@@ -94,15 +93,14 @@ done
9493
`, setting.ScriptType, util.ShellEscape(setting.AppPath), util.ShellEscape(setting.CustomConf)),
9594
}
9695

97-
if git.SupportProcReceive {
98-
hookNames = append(hookNames, "proc-receive")
99-
hookTpls = append(hookTpls,
100-
fmt.Sprintf(`#!/usr/bin/env %s
96+
// although only new git (>=2.29) supports proc-receive, it's still good to create its hook, in case the user upgrades git
97+
hookNames = append(hookNames, "proc-receive")
98+
hookTpls = append(hookTpls,
99+
fmt.Sprintf(`#!/usr/bin/env %s
101100
# AUTO GENERATED BY GITEA, DO NOT MODIFY
102101
%s hook --config=%s proc-receive
103102
`, setting.ScriptType, util.ShellEscape(setting.AppPath), util.ShellEscape(setting.CustomConf)))
104-
giteaHookTpls = append(giteaHookTpls, "")
105-
}
103+
giteaHookTpls = append(giteaHookTpls, "")
106104

107105
return hookNames, hookTpls, giteaHookTpls
108106
}

0 commit comments

Comments
 (0)