aboutsummaryrefslogtreecommitdiffstats
path: root/clients/common/common_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-31 19:38:42 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-31 19:38:42 +0200
commit484d472550d74138731bfdef4e68d8b810abb93f (patch)
tree235b361b6abb725b6bae08cf7b0904b34785912b /clients/common/common_test.go
parentd72a19796ef0f556db93b553547f2ac085b59a1a (diff)
downloadgo-git-484d472550d74138731bfdef4e68d8b810abb93f.tar.gz
clients/common: GitUploadPackInfo correct handling capabilities and symrefs
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)