aboutsummaryrefslogtreecommitdiffstats
path: root/clients/common/common_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-31 19:54:17 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-31 19:54:17 +0200
commit587d380585c08e9b5f839d06df0f0c7bd32218cf (patch)
tree6fa1e967214da00720ce9ccd04d426908ae05589 /clients/common/common_test.go
parent7aa8f0750c93b58876a06e79c50398901e5bdeb8 (diff)
parent484d472550d74138731bfdef4e68d8b810abb93f (diff)
downloadgo-git-587d380585c08e9b5f839d06df0f0c7bd32218cf.tar.gz
Merge branch 'v4' of github.com:src-d/go-git into v4
Diffstat (limited to 'clients/common/common_test.go')
-rw-r--r--clients/common/common_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/clients/common/common_test.go b/clients/common/common_test.go
index d2d3696..cc6c6d1 100644
--- a/clients/common/common_test.go
+++ b/clients/common/common_test.go
@@ -64,6 +64,24 @@ func (s *SuiteCommon) TestGitUploadPackInfo(c *C) {
c.Assert(ref.Target(), Equals, core.ReferenceName(name))
}
+const GitUploadPackInfoNoHEADFixture = "MDAxZSMgc2VydmljZT1naXQtdXBsb2FkLXBhY2sKMDAwMDAwYmNkN2UxZmVlMjYxMjM0YmIzYTQzYzA5NmY1NTg3NDhhNTY5ZDc5ZWZmIHJlZnMvaGVhZHMvdjQAbXVsdGlfYWNrIHRoaW4tcGFjayBzaWRlLWJhbmQgc2lkZS1iYW5kLTY0ayBvZnMtZGVsdGEgc2hhbGxvdyBuby1wcm9ncmVzcyBpbmNsdWRlLXRhZyBtdWx0aV9hY2tfZGV0YWlsZWQgbm8tZG9uZSBhZ2VudD1naXQvMS45LjEKMDAwMA=="
+
+func (s *SuiteCommon) TestGitUploadPackInfoNoHEAD(c *C) {
+ b, _ := base64.StdEncoding.DecodeString(GitUploadPackInfoNoHEADFixture)
+
+ i := NewGitUploadPackInfo()
+ err := i.Decode(pktline.NewDecoder(bytes.NewBuffer(b)))
+ c.Assert(err, IsNil)
+
+ name := i.Capabilities.SymbolicReference("HEAD")
+ c.Assert(name, Equals, "")
+ c.Assert(i.Refs, HasLen, 1)
+
+ ref := i.Refs["refs/heads/v4"]
+ c.Assert(ref, NotNil)
+ c.Assert(ref.Hash().String(), Equals, "d7e1fee261234bb3a43c096f558748a569d79eff")
+}
+
func (s *SuiteCommon) TestGitUploadPackInfoEmpty(c *C) {
b := bytes.NewBuffer(nil)