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 /plumbing/transport/server/server.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 'plumbing/transport/server/server.go')
-rw-r--r-- | plumbing/transport/server/server.go | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/plumbing/transport/server/server.go b/plumbing/transport/server/server.go index 79b64a1..457240f 100644 --- a/plumbing/transport/server/server.go +++ b/plumbing/transport/server/server.go @@ -9,7 +9,6 @@ import ( "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/revlist" @@ -153,26 +152,12 @@ func (s *upSession) UploadPack(req *packp.UploadPackRequest) (*packp.UploadPackR } func (s *upSession) objectsToUpload(req *packp.UploadPackRequest) ([]plumbing.Hash, error) { - commits, err := s.commitsToUpload(req.Wants) + haves, err := revlist.Objects(s.storer, req.Haves, nil) if err != nil { return nil, err } - return revlist.Objects(s.storer, commits, req.Haves) -} - -func (s *upSession) commitsToUpload(wants []plumbing.Hash) ([]*object.Commit, error) { - var commits []*object.Commit - for _, h := range wants { - c, err := object.GetCommit(s.storer, h) - if err != nil { - return nil, err - } - - commits = append(commits, c) - } - - return commits, nil + return revlist.Objects(s.storer, req.Wants, haves) } func (*upSession) setSupportedCapabilities(c *capability.List) error { |