Fix ~depth parameter for git downloads
This commit is contained in:
parent
74cc88580e
commit
ab1826f523
|
@ -76,7 +76,7 @@ func Get(ctx context.Context, opts GetOptions) error {
|
||||||
commit := query.Get("~commit")
|
commit := query.Get("~commit")
|
||||||
query.Del("~commit")
|
query.Del("~commit")
|
||||||
|
|
||||||
depth := query.Get("~depth")
|
depthStr := query.Get("~depth")
|
||||||
query.Del("~depth")
|
query.Del("~depth")
|
||||||
|
|
||||||
var refName plumbing.ReferenceName
|
var refName plumbing.ReferenceName
|
||||||
|
@ -98,9 +98,12 @@ func Get(ctx context.Context, opts GetOptions) error {
|
||||||
dstDir = filepath.Join(opts.Destination, name)
|
dstDir = filepath.Join(opts.Destination, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
depth, err := strconv.Atoi(depth)
|
depth := 0
|
||||||
if err != nil {
|
if depthStr != "" {
|
||||||
return err
|
depth, err = strconv.Atoi(depthStr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cloneOpts := &git.CloneOptions{
|
cloneOpts := &git.CloneOptions{
|
||||||
|
|
Loading…
Reference in New Issue