aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/remote.go b/remote.go
index 666c9f5..4b86955 100644
--- a/remote.go
+++ b/remote.go
@@ -976,9 +976,24 @@ func pushHashes(
}
func (r *Remote) updateShallow(o *FetchOptions, resp *packp.UploadPackResponse) error {
- if o.Depth == 0 {
+ if o.Depth == 0 || len(resp.Shallows) == 0 {
return nil
}
- return r.s.SetShallow(resp.Shallows)
+ shallows, err := r.s.Shallow()
+ if err != nil {
+ return err
+ }
+
+outer:
+ for _, s := range resp.Shallows {
+ for _, oldS := range shallows {
+ if s == oldS {
+ continue outer
+ }
+ }
+ shallows = append(shallows, s)
+ }
+
+ return r.s.SetShallow(shallows)
}