aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/updreq_test.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-12-09 14:44:03 +0100
committerGitHub <noreply@github.com>2016-12-09 14:44:03 +0100
commit0e1a52757a3938e97cf7d31e0dff3c9949001763 (patch)
tree8b998fdc3eaaf6b2d6c69a125759a778664207a5 /plumbing/protocol/packp/updreq_test.go
parent4f16cc925238aae81586e917d26b8ff6b6a340bd (diff)
downloadgo-git-0e1a52757a3938e97cf7d31e0dff3c9949001763.tar.gz
transport: add git-send-pack support to local/ssh. (#163)
* protocol/packp: add Packfile field to ReferenceUpdateRequest. * protocol/packp: add NewReferenceUpdateRequestFromCapabilities. * NewReferenceUpdateRequestFromCapabilities can be used to create a ReferenceUpdateRequest with initial capabilities compatible with the server. * protocol/packp: fix new line handling on report status. * transport/file: test error on unexisting command.
Diffstat (limited to 'plumbing/protocol/packp/updreq_test.go')
-rw-r--r--plumbing/protocol/packp/updreq_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/plumbing/protocol/packp/updreq_test.go b/plumbing/protocol/packp/updreq_test.go
new file mode 100644
index 0000000..2412fbf
--- /dev/null
+++ b/plumbing/protocol/packp/updreq_test.go
@@ -0,0 +1,39 @@
+package packp
+
+import (
+ "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
+
+ . "gopkg.in/check.v1"
+)
+
+type UpdReqSuite struct{}
+
+var _ = Suite(&UpdReqSuite{})
+
+func (s *UpdReqSuite) TestNewReferenceUpdateRequestFromCapabilities(c *C) {
+ cap := capability.NewList()
+ cap.Set(capability.Sideband)
+ cap.Set(capability.Sideband64k)
+ cap.Set(capability.Quiet)
+ cap.Set(capability.ReportStatus)
+ cap.Set(capability.DeleteRefs)
+ cap.Set(capability.PushCert, "foo")
+ cap.Set(capability.Atomic)
+ cap.Set(capability.Agent, "foo")
+
+ r := NewReferenceUpdateRequestFromCapabilities(cap)
+ c.Assert(r.Capabilities.String(), Equals,
+ "agent=go-git/4.x report-status",
+ )
+
+ cap = capability.NewList()
+ cap.Set(capability.Agent, "foo")
+
+ r = NewReferenceUpdateRequestFromCapabilities(cap)
+ c.Assert(r.Capabilities.String(), Equals, "agent=go-git/4.x")
+
+ cap = capability.NewList()
+
+ r = NewReferenceUpdateRequestFromCapabilities(cap)
+ c.Assert(r.Capabilities.String(), Equals, "")
+}