diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-13 01:51:00 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-13 01:51:00 +0200 |
commit | a6ea9e8dd2eda48c8405f609e0fb444d3717af53 (patch) | |
tree | a2815bca686619d10151a531cddf5a7fdadedffa /clients | |
parent | ae999ede139f5fa5601ffb7c55979608b112d274 (diff) | |
download | go-git-a6ea9e8dd2eda48c8405f609e0fb444d3717af53.tar.gz |
Repository and Remote API changes
Diffstat (limited to 'clients')
-rw-r--r-- | clients/common/common.go | 21 | ||||
-rw-r--r-- | clients/common_test.go | 2 | ||||
-rw-r--r-- | clients/http/git_upload_pack.go | 1 |
3 files changed, 7 insertions, 17 deletions
diff --git a/clients/common/common.go b/clients/common/common.go index a09f2d8..fbd8066 100644 --- a/clients/common/common.go +++ b/clients/common/common.go @@ -10,6 +10,7 @@ import ( "gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/formats/pktline" + "gopkg.in/src-d/go-git.v4/storage/memory" "gopkg.in/sourcegraph/go-vcsurl.v1" ) @@ -180,7 +181,7 @@ func (c *Capabilities) String() string { type GitUploadPackInfo struct { Capabilities *Capabilities - Refs map[core.ReferenceName]*core.Reference + Refs memory.ReferenceStorage } func NewGitUploadPackInfo() *GitUploadPackInfo { @@ -206,7 +207,7 @@ func (r *GitUploadPackInfo) read(d *pktline.Decoder) error { } isEmpty := true - r.Refs = map[core.ReferenceName]*core.Reference{} + r.Refs = make(memory.ReferenceStorage, 0) for _, line := range lines { if !r.isValidLine(line) { continue @@ -237,7 +238,7 @@ func (r *GitUploadPackInfo) decodeHeaderLine(line string) { } refName := core.ReferenceName(name) - r.Refs[core.HEAD] = core.NewSymbolicReference(core.HEAD, refName) + r.Refs.Set(core.NewSymbolicReference(core.HEAD, refName)) } func (r *GitUploadPackInfo) isValidLine(line string) bool { @@ -250,21 +251,11 @@ func (r *GitUploadPackInfo) readLine(line string) { return } - ref := core.NewReferenceFromStrings(parts[1], parts[0]) - r.Refs[ref.Name()] = ref + r.Refs.Set(core.NewReferenceFromStrings(parts[1], parts[0])) } func (r *GitUploadPackInfo) Head() *core.Reference { - h, ok := r.Refs[core.HEAD] - if !ok { - return nil - } - - ref, ok := r.Refs[h.Target()] - if !ok { - return nil - } - + ref, _ := core.ResolveReference(r.Refs, core.HEAD) return ref } diff --git a/clients/common_test.go b/clients/common_test.go index acc8d68..f27b814 100644 --- a/clients/common_test.go +++ b/clients/common_test.go @@ -20,7 +20,7 @@ type SuiteCommon struct { var _ = Suite(&SuiteCommon{}) -const fixtureTGZ = "../storage/filesystem/internal/gitdir/fixtures/spinnaker-gc.tgz" +const fixtureTGZ = "../storage/filesystem/internal/dotgit/fixtures/spinnaker-gc.tgz" func (s *SuiteCommon) SetUpSuite(c *C) { var err error diff --git a/clients/http/git_upload_pack.go b/clients/http/git_upload_pack.go index 1113eb1..860318f 100644 --- a/clients/http/git_upload_pack.go +++ b/clients/http/git_upload_pack.go @@ -26,7 +26,6 @@ func NewGitUploadPackService() *GitUploadPackService { func (s *GitUploadPackService) Connect(url common.Endpoint) error { s.endpoint = url - return nil } |