From dcf3dcec67fdf2c82a4b9cb67c3ba418b06ad31f Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Tue, 18 Oct 2022 10:02:10 +0100 Subject: [PATCH] Enable use of MultiACK and MultiACKDetailed Signed-off-by: Paulo Gomes --- plumbing/protocol/packp/srvresp.go | 5 ----- plumbing/protocol/packp/srvresp_test.go | 2 +- plumbing/protocol/packp/uppackresp_test.go | 2 +- plumbing/transport/common.go | 2 -- plumbing/transport/common_test.go | 2 +- plumbing/transport/test/upload_pack.go | 3 +-- 6 files changed, 4 insertions(+), 12 deletions(-) diff --git a/plumbing/protocol/packp/srvresp.go b/plumbing/protocol/packp/srvresp.go index b3a7ee804..5369ce14f 100644 --- a/plumbing/protocol/packp/srvresp.go +++ b/plumbing/protocol/packp/srvresp.go @@ -21,11 +21,6 @@ type ServerResponse struct { // Decode decodes the response into the struct, isMultiACK should be true, if // the request was done with multi_ack or multi_ack_detailed capabilities. func (r *ServerResponse) Decode(reader *bufio.Reader, isMultiACK bool) error { - // TODO: implement support for multi_ack or multi_ack_detailed responses - if isMultiACK { - return errors.New("multi_ack and multi_ack_detailed are not supported") - } - s := pktline.NewScanner(reader) for s.Scan() { diff --git a/plumbing/protocol/packp/srvresp_test.go b/plumbing/protocol/packp/srvresp_test.go index 02fab424e..f22859547 100644 --- a/plumbing/protocol/packp/srvresp_test.go +++ b/plumbing/protocol/packp/srvresp_test.go @@ -75,5 +75,5 @@ func (s *ServerResponseSuite) TestDecodeMalformed(c *C) { func (s *ServerResponseSuite) TestDecodeMultiACK(c *C) { sr := &ServerResponse{} err := sr.Decode(bufio.NewReader(bytes.NewBuffer(nil)), true) - c.Assert(err, NotNil) + c.Assert(err, IsNil) } diff --git a/plumbing/protocol/packp/uppackresp_test.go b/plumbing/protocol/packp/uppackresp_test.go index 260dc5748..27d85f9c6 100644 --- a/plumbing/protocol/packp/uppackresp_test.go +++ b/plumbing/protocol/packp/uppackresp_test.go @@ -67,7 +67,7 @@ func (s *UploadPackResponseSuite) TestDecodeMultiACK(c *C) { defer res.Close() err := res.Decode(ioutil.NopCloser(bytes.NewBuffer(nil))) - c.Assert(err, NotNil) + c.Assert(err, IsNil) } func (s *UploadPackResponseSuite) TestReadNoDecode(c *C) { diff --git a/plumbing/transport/common.go b/plumbing/transport/common.go index a2a78f028..9e0ea1308 100644 --- a/plumbing/transport/common.go +++ b/plumbing/transport/common.go @@ -268,8 +268,6 @@ func parseFile(endpoint string) (*Endpoint, bool) { // UnsupportedCapabilities are the capabilities not supported by any client // implementation var UnsupportedCapabilities = []capability.Capability{ - capability.MultiACK, - capability.MultiACKDetailed, capability.ThinPack, } diff --git a/plumbing/transport/common_test.go b/plumbing/transport/common_test.go index 0c5a01a9a..1373f3a22 100644 --- a/plumbing/transport/common_test.go +++ b/plumbing/transport/common_test.go @@ -184,5 +184,5 @@ func (s *SuiteCommon) TestFilterUnsupportedCapabilities(c *C) { l.Set(capability.MultiACK) FilterUnsupportedCapabilities(l) - c.Assert(l.Supports(capability.MultiACK), Equals, false) + c.Assert(l.Supports(capability.MultiACK), Equals, true) } diff --git a/plumbing/transport/test/upload_pack.go b/plumbing/transport/test/upload_pack.go index 3ee029d40..dd6fc8dac 100644 --- a/plumbing/transport/test/upload_pack.go +++ b/plumbing/transport/test/upload_pack.go @@ -1,6 +1,5 @@ // Package test implements common test suite for different transport // implementations. -// package test import ( @@ -88,7 +87,7 @@ func (s *UploadPackSuite) TestAdvertisedReferencesFilterUnsupported(c *C) { info, err := r.AdvertisedReferences() c.Assert(err, IsNil) - c.Assert(info.Capabilities.Supports(capability.MultiACK), Equals, false) + c.Assert(info.Capabilities.Supports(capability.MultiACK), Equals, true) } func (s *UploadPackSuite) TestCapabilities(c *C) {