aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/remote.go b/remote.go
index 1d3291b..5d1a8c0 100644
--- a/remote.go
+++ b/remote.go
@@ -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)