Fix ~depth parameter for git downloads

This commit is contained in:
Elara 2022-09-27 19:57:22 -07:00
parent 74cc88580e
commit ab1826f523
1 changed files with 7 additions and 4 deletions

View File

@ -76,7 +76,7 @@ func Get(ctx context.Context, opts GetOptions) error {
commit := query.Get("~commit")
query.Del("~commit")
depth := query.Get("~depth")
depthStr := query.Get("~depth")
query.Del("~depth")
var refName plumbing.ReferenceName
@ -98,9 +98,12 @@ func Get(ctx context.Context, opts GetOptions) error {
dstDir = filepath.Join(opts.Destination, name)
}
depth, err := strconv.Atoi(depth)
if err != nil {
return err
depth := 0
if depthStr != "" {
depth, err = strconv.Atoi(depthStr)
if err != nil {
return err
}
}
cloneOpts := &git.CloneOptions{