1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

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>
This commit is contained in:
Gusted
2022-01-23 21:46:09 +00:00
committed by GitHub
parent 160de9fbda
commit 42991dc89a
5 changed files with 33 additions and 9 deletions

View File

@@ -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