diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-12-15 13:45:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-15 13:45:52 +0100 |
commit | 249c4137f4f34992c9bb6a60954e30a27994add7 (patch) | |
tree | 1188a410d368c619548d74798c474e04469eabae /remote.go | |
parent | f01fd176ff61a3f37d096939690aa103de054ecc (diff) | |
download | go-git-249c4137f4f34992c9bb6a60954e30a27994add7.tar.gz |
storage: shallow storage (#180)
* storage: shallow storage
* changes
* changes
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) |