From f20061586f9e099103ea6dc7622e293417e6066c Mon Sep 17 00:00:00 2001 From: Andrew Thornton <art27@cantab.net> Date: Sat, 20 Aug 2022 20:40:02 +0100 Subject: [PATCH] Set uploadpack.allowFilter etc on gitea serv to enable partial clones 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 #20400 Signed-off-by: Andrew Thornton <art27@cantab.net> --- cmd/serv.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/serv.go b/cmd/serv.go index b00c3962f41fb..3e3adb3d8737a 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -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) }