aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-12-15 13:45:52 +0100
committerGitHub <noreply@github.com>2016-12-15 13:45:52 +0100
commit249c4137f4f34992c9bb6a60954e30a27994add7 (patch)
tree1188a410d368c619548d74798c474e04469eabae /remote.go
parentf01fd176ff61a3f37d096939690aa103de054ecc (diff)
downloadgo-git-249c4137f4f34992c9bb6a60954e30a27994add7.tar.gz
storage: shallow storage (#180)
* storage: shallow storage * changes * changes
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)