From 9a469de36eee1eb07c460b9d8c27c3ba5fe8e06e Mon Sep 17 00:00:00 2001 From: Antonio Jesus Navarro Perez Date: Mon, 27 Feb 2017 15:34:06 +0100 Subject: plumbing/revlist: input as a slice of hashes instead of commits - Now the input of the method Objects inside revlist package is a slice of hashes instead of commits. Hashes can be from Blobs, Trees and Commits objects. - ObjectStorer now is used to obtain the object content using hashes slice. - This PR fix #222. Now a test into upload_pack_test.go file is not skipped anymore. - Remove code from remote.go and server.go that is not necessary. --- plumbing/transport/server/server.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'plumbing/transport/server/server.go') 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 { -- cgit