Skip to content

Commit

Permalink
Always write proc-receive hook for all git versions (go-gitea#29287)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Feb 21, 2024
1 parent e940443 commit aee6378
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions modules/repository/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit aee6378

Please sign in to comment.