diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-19 14:15:34 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-19 14:15:34 +0200 |
commit | d851b90f5e832fa1edeb0d408bd56ed6c1fd5e7a (patch) | |
tree | ab25942ff243173a27979bc357d6bc516dda65d1 /remote.go | |
parent | 95bfc7e1c1b7101f2cd605cda58c1fb43d501d35 (diff) | |
download | go-git-d851b90f5e832fa1edeb0d408bd56ed6c1fd5e7a.tar.gz |
repository: allow push from shallow repositories
Diffstat (limited to 'remote.go')
-rw-r--r-- | remote.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -104,6 +104,7 @@ func (r *Remote) Push(o *PushOptions) (err error) { req := packp.NewReferenceUpdateRequestFromCapabilities(ar.Capabilities) if err := r.addReferencesToUpdate(o.RefSpecs, remoteRefs, req); err != nil { + return err } @@ -121,6 +122,15 @@ func (r *Remote) Push(o *PushOptions) (err error) { return err } + stop, err := r.s.Shallow() + if err != nil { + return err + } + + // if we have shallow we should include this as part of the objects that + // we are aware. + haves = append(haves, stop...) + hashesToPush, err := revlist.Objects(r.s, objects, haves) if err != nil { return err @@ -486,7 +496,7 @@ func isFastForward(s storer.EncodedObjectStorer, old, new plumbing.Hash) (bool, } found := false - iter := object.NewCommitPreorderIter(c) + iter := object.NewCommitPreorderIter(c, nil) return found, iter.ForEach(func(c *object.Commit) error { if c.Hash != old { return nil |