diff options
Diffstat (limited to 'remote.go')
-rw-r--r-- | remote.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -129,6 +129,10 @@ func (r *Remote) Fetch(o *FetchOptions) (err error) { defer ioutil.CheckClose(reader, &err) + if err := r.updateShallow(o, reader); err != nil { + return err + } + if err = r.updateObjectStorage( r.buildSidebandIfSupported(req.Capabilities, reader), ); err != nil { @@ -295,6 +299,14 @@ func (r *Remote) buildFetchedTags() error { }) } +func (r *Remote) updateShallow(o *FetchOptions, resp *packp.UploadPackResponse) error { + if o.Depth == 0 { + return nil + } + + return r.s.SetShallow(resp.Shallows) +} + // Head returns the Reference of the HEAD func (r *Remote) Head() *plumbing.Reference { ref, err := storer.ResolveReference(r.refs, plumbing.HEAD) |