diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-08 01:59:48 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-08 01:59:48 +0200 |
commit | a3dc077738fc55629f22e4effd389385a49f68cc (patch) | |
tree | 9abcb178c33481dbcb7655a668100e9b9185527d /plumbing/protocol/packp/uppackresp.go | |
parent | 102d4b5aeb9b3cbd544c59706a1b0dd9300ddcc8 (diff) | |
download | go-git-a3dc077738fc55629f22e4effd389385a49f68cc.tar.gz |
plumbing: protocol, fix handling multiple ACK on upload-pack
Diffstat (limited to 'plumbing/protocol/packp/uppackresp.go')
-rw-r--r-- | plumbing/protocol/packp/uppackresp.go | 10 |
1 files changed, 7 insertions, 3 deletions
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 } |