aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-02-27 15:34:06 +0100
committerAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-02-27 18:01:32 +0100
commit9a469de36eee1eb07c460b9d8c27c3ba5fe8e06e (patch)
treea69f35d28c9c2c36341a2d87b50ab128bf7ef868 /plumbing/transport
parent39f43b52a2bdfbc73703e2d09b575d49cd70ede8 (diff)
downloadgo-git-9a469de36eee1eb07c460b9d8c27c3ba5fe8e06e.tar.gz
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.
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/server/server.go19
-rw-r--r--plumbing/transport/server/upload_pack_test.go5
2 files changed, 2 insertions, 22 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 {
diff --git a/plumbing/transport/server/upload_pack_test.go b/plumbing/transport/server/upload_pack_test.go
index d127522..4fc3be2 100644
--- a/plumbing/transport/server/upload_pack_test.go
+++ b/plumbing/transport/server/upload_pack_test.go
@@ -38,8 +38,3 @@ func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) {
c.Assert(err, Equals, transport.ErrRepositoryNotFound)
c.Assert(r, IsNil)
}
-
-// TODO revList implementation is returning more objects than expected.
-func (s *UploadPackSuite) TestUploadPackPartial(c *C) {
- c.Skip("Fix revList implementation")
-}