From a3dc077738fc55629f22e4effd389385a49f68cc Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sat, 8 Jul 2017 01:59:48 +0200 Subject: plumbing: protocol, fix handling multiple ACK on upload-pack --- plumbing/protocol/packp/uppackresp.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'plumbing/protocol/packp/uppackresp.go') diff --git a/plumbing/protocol/packp/uppackresp.go b/plumbing/protocol/packp/uppackresp.go index ac456f3..c18e159 100644 --- a/plumbing/protocol/packp/uppackresp.go +++ b/plumbing/protocol/packp/uppackresp.go @@ -4,6 +4,8 @@ import ( "errors" "io" + "bufio" + "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability" "gopkg.in/src-d/go-git.v4/utils/ioutil" ) @@ -51,18 +53,20 @@ func NewUploadPackResponseWithPackfile(req *UploadPackRequest, // Decode decodes all the responses sent by upload-pack service into the struct // and prepares it to read the packfile using the Read method func (r *UploadPackResponse) Decode(reader io.ReadCloser) error { + buf := bufio.NewReader(reader) + if r.isShallow { - if err := r.ShallowUpdate.Decode(reader); err != nil { + if err := r.ShallowUpdate.Decode(buf); err != nil { return err } } - if err := r.ServerResponse.Decode(reader, r.isMultiACK); err != nil { + if err := r.ServerResponse.Decode(buf, r.isMultiACK); err != nil { return err } // now the reader is ready to read the packfile content - r.r = reader + r.r = ioutil.NewReadCloser(buf, reader) return nil } -- cgit