diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-28 13:08:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 13:08:07 +0100 |
commit | ab6f224e98d876beb8c146497c60717b4fe56b2a (patch) | |
tree | c140cfa08f9f1bc7b36446bd07439e038b016ee2 /remote.go | |
parent | 0e9dea19f856e256e609c3390e000760d2b2b95a (diff) | |
parent | 9a469de36eee1eb07c460b9d8c27c3ba5fe8e06e (diff) | |
download | go-git-ab6f224e98d876beb8c146497c60717b4fe56b2a.tar.gz |
Merge pull request #292 from ajnavarro/improvement/revlist
plumbing/revlist: input as a slice of hashes instead of commits
Diffstat (limited to 'remote.go')
-rw-r--r-- | remote.go | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -8,7 +8,6 @@ import ( "srcd.works/go-git.v4/config" "srcd.works/go-git.v4/plumbing" "srcd.works/go-git.v4/plumbing/format/packfile" - "srcd.works/go-git.v4/plumbing/object" "srcd.works/go-git.v4/plumbing/protocol/packp" "srcd.works/go-git.v4/plumbing/protocol/packp/capability" "srcd.works/go-git.v4/plumbing/protocol/packp/sideband" @@ -97,7 +96,7 @@ func (r *Remote) Push(o *PushOptions) (err error) { return NoErrAlreadyUpToDate } - commits, err := commitsToPush(r.s, req.Commands) + objects, err := objectsToPush(req.Commands) if err != nil { return err } @@ -107,7 +106,7 @@ func (r *Remote) Push(o *PushOptions) (err error) { return err } - hashesToPush, err := revlist.Objects(r.s, commits, haves) + hashesToPush, err := revlist.Objects(r.s, objects, haves) if err != nil { return err } @@ -476,22 +475,17 @@ func (r *Remote) buildFetchedTags(refs storer.ReferenceStorer) error { }) } -func commitsToPush(s storer.EncodedObjectStorer, commands []*packp.Command) ([]*object.Commit, error) { - var commits []*object.Commit +func objectsToPush(commands []*packp.Command) ([]plumbing.Hash, error) { + var objects []plumbing.Hash for _, cmd := range commands { if cmd.New == plumbing.ZeroHash { continue } - c, err := object.GetCommit(s, cmd.New) - if err != nil { - return nil, err - } - - commits = append(commits, c) + objects = append(objects, cmd.New) } - return commits, nil + return objects, nil } func referencesToHashes(refs storer.ReferenceStorer) ([]plumbing.Hash, error) { |