Fix partial cloning a repo (#18373)
- Pass the Global command args into serviceRPC. - Fixes error with partial cloning. - Add partial clone test - Include diff Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
5e5740af69
commit
c2e13fb763
6 changed files with 24 additions and 4 deletions
|
@ -81,7 +81,7 @@ func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diff
|
|||
}
|
||||
|
||||
stderr := new(bytes.Buffer)
|
||||
cmd := NewCommandContextNoGlobals(repo.Ctx, args...)
|
||||
cmd := NewCommandContext(repo.Ctx, args...)
|
||||
if err = cmd.RunWithContext(&RunContext{
|
||||
Timeout: -1,
|
||||
Dir: repo.Path,
|
||||
|
|
|
@ -101,6 +101,7 @@ type CloneRepoOptions struct {
|
|||
Shared bool
|
||||
NoCheckout bool
|
||||
Depth int
|
||||
Filter string
|
||||
}
|
||||
|
||||
// Clone clones original repository to target path.
|
||||
|
@ -136,7 +137,9 @@ func CloneWithArgs(ctx context.Context, from, to string, args []string, opts Clo
|
|||
if opts.Depth > 0 {
|
||||
cmd.AddArguments("--depth", strconv.Itoa(opts.Depth))
|
||||
}
|
||||
|
||||
if opts.Filter != "" {
|
||||
cmd.AddArguments("--filter", opts.Filter)
|
||||
}
|
||||
if len(opts.Branch) > 0 {
|
||||
cmd.AddArguments("-b", opts.Branch)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue