diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-12 10:47:49 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-12 10:47:49 +0200 |
commit | bd6acd02c98e93855b2781f7e1fb167804ce62b1 (patch) | |
tree | d49c748451df300c2418e1f7c6a66b6b33bc7c62 /plumbing/protocol/packp/srvresp_test.go | |
parent | 09cd5ccfd384be79e8c49d0d0bccd22589098809 (diff) | |
download | go-git-bd6acd02c98e93855b2781f7e1fb167804ce62b1.tar.gz |
plumbing: protocol, fix handling multiple ACK on upload-pack
Diffstat (limited to 'plumbing/protocol/packp/srvresp_test.go')
-rw-r--r-- | plumbing/protocol/packp/srvresp_test.go | 25 |
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) { |