Skip to content

Commit

Permalink
Set uploadpack.allowFilter etc on gitea serv to enable partial clones…
Browse files Browse the repository at this point in the history
… with ssh

When setting.Git.DisablePartialClone is set to false then the
web server will add filter support to web http. The ssh serv
wrapper is missing this code and therefore we need to add it.

Fix go-gitea#20400

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Aug 20, 2022
1 parent 3d52edc commit f200615
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/serv.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ func runServ(c *cli.Context) error {
// it could be re-considered whether to use the same git.CommonGitCmdEnvs() as "git" command later.
gitcmd.Env = append(gitcmd.Env, git.CommonCmdServEnvs()...)

// By default partial clones are disabled, enable them from git v2.22
if !setting.Git.DisablePartialClone && git.CheckGitVersionAtLeast("2.22") == nil {
gitcmd.Env = append(gitcmd.Env, "-c", "uploadpack.allowfilter=true", "-c", "uploadpack.allowAnySHA1InWant=true")
}

if err = gitcmd.Run(); err != nil {
return fail("Internal error", "Failed to execute git command: %v", err)
}
Expand Down

0 comments on commit f200615

Please sign in to comment.