diff options
Diffstat (limited to 'clients')
-rw-r--r-- | clients/common/common.go | 12 | ||||
-rw-r--r-- | clients/common/common_test.go | 19 | ||||
-rw-r--r-- | clients/http/git_upload_pack_test.go | 5 |
3 files changed, 26 insertions, 10 deletions
diff --git a/clients/common/common.go b/clients/common/common.go index 5da0570..4204cb7 100644 --- a/clients/common/common.go +++ b/clients/common/common.go @@ -6,8 +6,10 @@ import ( "net/url" "strings" - "gopkg.in/sourcegraph/go-vcsurl.v1" "gopkg.in/src-d/go-git.v2/formats/pktline" + "gopkg.in/src-d/go-git.v2/internal" + + "gopkg.in/sourcegraph/go-vcsurl.v1" ) const GitUploadPackServiceName = "git-upload-pack" @@ -74,7 +76,7 @@ func (r Capabilities) SymbolicReference(sym string) string { } type RemoteHead struct { - Id string + Id internal.Hash Name string } @@ -134,12 +136,12 @@ func (r *GitUploadPackInfo) getRemoteHead(line string) *RemoteHead { return nil } - return &RemoteHead{parts[0], parts[1]} + return &RemoteHead{internal.NewHash(parts[0]), parts[1]} } type GitUploadPackRequest struct { - Want []string - Have []string + Want []internal.Hash + Have []internal.Hash } func (r *GitUploadPackRequest) String() string { diff --git a/clients/common/common_test.go b/clients/common/common_test.go index 74492f0..43faf5b 100644 --- a/clients/common/common_test.go +++ b/clients/common/common_test.go @@ -7,6 +7,7 @@ import ( . "gopkg.in/check.v1" "gopkg.in/src-d/go-git.v2/formats/pktline" + "gopkg.in/src-d/go-git.v2/internal" ) func Test(t *testing.T) { TestingT(t) } @@ -48,15 +49,25 @@ func (s *SuiteCommon) TestGitUploadPackInfo(c *C) { ref := info.Capabilities.SymbolicReference("HEAD") c.Assert(ref, Equals, "refs/heads/master") - c.Assert(info.Refs[ref].Id, Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5") + c.Assert(info.Refs[ref].Id.String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5") c.Assert(info.Refs[ref].Name, Equals, "refs/heads/master") } func (s *SuiteCommon) TestGitUploadPackRequest(c *C) { r := &GitUploadPackRequest{ - Want: []string{"foo", "qux"}, - Have: []string{"bar"}, + Want: []internal.Hash{ + internal.NewHash("d82f291cde9987322c8a0c81a325e1ba6159684c"), + internal.NewHash("2b41ef280fdb67a9b250678686a0c3e03b0a9989"), + }, + Have: []internal.Hash{ + internal.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"), + }, } - c.Assert(r.String(), Equals, "000dwant foo\n000dwant qux\n000dhave bar\n00000009done\n") + c.Assert(r.String(), Equals, + "0032want d82f291cde9987322c8a0c81a325e1ba6159684c\n"+ + "0032want 2b41ef280fdb67a9b250678686a0c3e03b0a9989\n"+ + "0032have 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n0000"+ + "0009done\n", + ) } diff --git a/clients/http/git_upload_pack_test.go b/clients/http/git_upload_pack_test.go index 603cd1b..7234766 100644 --- a/clients/http/git_upload_pack_test.go +++ b/clients/http/git_upload_pack_test.go @@ -5,6 +5,7 @@ import ( . "gopkg.in/check.v1" "gopkg.in/src-d/go-git.v2/clients/common" + "gopkg.in/src-d/go-git.v2/internal" ) type SuiteRemote struct{} @@ -41,7 +42,9 @@ func (s *SuiteRemote) TestFetch(c *C) { c.Assert(r.Connect(RepositoryFixture), IsNil) reader, err := r.Fetch(&common.GitUploadPackRequest{ - Want: []string{"6ecf0ef2c2dffb796033e5a02219af86ec6584e5"}, + Want: []internal.Hash{ + internal.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"), + }, }) c.Assert(err, IsNil) |