aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/srvresp_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-07-12 02:02:34 -0700
committerGitHub <noreply@github.com>2017-07-12 02:02:34 -0700
commitdf946d7d1c4551b3c8e87183012e3a48efbbfe76 (patch)
tree49d4f72fe9e62f16f0e97b7537fef1a3b7878809 /plumbing/protocol/packp/srvresp_test.go
parentec0f30691de82d5e48827ba275acfad585d60963 (diff)
parentbd6acd02c98e93855b2781f7e1fb167804ce62b1 (diff)
downloadgo-git-df946d7d1c4551b3c8e87183012e3a48efbbfe76.tar.gz
Merge pull request #475 from mcuadros/fix-ack
plumbing: protocol, fix handling multiple ACK on upload-pack and test…
Diffstat (limited to 'plumbing/protocol/packp/srvresp_test.go')
-rw-r--r--plumbing/protocol/packp/srvresp_test.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/plumbing/protocol/packp/srvresp_test.go b/plumbing/protocol/packp/srvresp_test.go
index a873b45..c8ef520 100644
--- a/plumbing/protocol/packp/srvresp_test.go
+++ b/plumbing/protocol/packp/srvresp_test.go
@@ -35,14 +35,33 @@ func (s *ServerResponseSuite) TestDecodeACK(c *C) {
}
func (s *ServerResponseSuite) TestDecodeMultipleACK(c *C) {
- raw := "0031ACK 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n0031ACK 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n"
+ raw := "" +
+ "0031ACK 1111111111111111111111111111111111111111\n" +
+ "0031ACK 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n" +
+ "00080PACK\n"
sr := &ServerResponse{}
err := sr.Decode(bufio.NewReader(bytes.NewBufferString(raw)), false)
c.Assert(err, IsNil)
- c.Assert(sr.ACKs, HasLen, 1)
- c.Assert(sr.ACKs[0], Equals, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))
+ c.Assert(sr.ACKs, HasLen, 2)
+ c.Assert(sr.ACKs[0], Equals, plumbing.NewHash("1111111111111111111111111111111111111111"))
+ c.Assert(sr.ACKs[1], Equals, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))
+}
+
+func (s *ServerResponseSuite) TestDecodeMultipleACKWithSideband(c *C) {
+ raw := "" +
+ "0031ACK 1111111111111111111111111111111111111111\n" +
+ "0031ACK 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n" +
+ "00080aaaa\n"
+
+ sr := &ServerResponse{}
+ err := sr.Decode(bufio.NewReader(bytes.NewBufferString(raw)), false)
+ c.Assert(err, IsNil)
+
+ c.Assert(sr.ACKs, HasLen, 2)
+ c.Assert(sr.ACKs[0], Equals, plumbing.NewHash("1111111111111111111111111111111111111111"))
+ c.Assert(sr.ACKs[1], Equals, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))
}
func (s *ServerResponseSuite) TestDecodeMalformed(c *C) {