diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-01-23 21:46:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-23 21:46:09 +0000 |
commit | 42991dc89a7f3dadb7ad3b36d18b1a74628ec272 (patch) | |
tree | 82b22104610a0e6b117f34d1e32d18db6a5b6146 /routers | |
parent | 160de9fbdac41580b9cba88061bfaf1b3324d5a8 (diff) | |
download | gitea-42991dc89a7f3dadb7ad3b36d18b1a74628ec272.tar.gz gitea-42991dc89a7f3dadb7ad3b36d18b1a74628ec272.zip |
Fix partial cloning a repo (#18373) (#18377)
* Fix partial cloning a repo (#18373)
- Backport from: #18373
- Backport isn't 1-1, because the frontport had a refactor in that area,
which v1.16 doesn't have.
* Include diff & use copy
* Add partial clone test
* patch
* Apply suggestions from code review
* globalArgs first
* avoid copy but make GlobalCMDArgs append first
* please linter
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/http.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index 6ebf6a789a..f5ca7f1856 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -491,7 +491,10 @@ func serviceRPC(h serviceHandler, service string) { defer finished() var stderr bytes.Buffer - cmd := exec.CommandContext(ctx, git.GitExecutable, service, "--stateless-rpc", h.dir) + args := make([]string, len(git.GlobalCommandArgs)) + copy(args, git.GlobalCommandArgs) + args = append(args, []string{service, "--stateless-rpc", h.dir}...) + cmd := exec.CommandContext(ctx, git.GitExecutable, args...) cmd.Dir = h.dir cmd.Env = append(os.Environ(), h.environ...) cmd.Stdout = h.w |