diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-11 01:41:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 01:41:37 -0700 |
commit | 09cd5ccfd384be79e8c49d0d0bccd22589098809 (patch) | |
tree | 5c8537c62e7a5fb35c57cd572aa25f9f55f54441 /plumbing/protocol/packp/uppackresp.go | |
parent | 6b69a1630b30c41f4563fd95aca1d647ba611adf (diff) | |
parent | a3dc077738fc55629f22e4effd389385a49f68cc (diff) | |
download | go-git-09cd5ccfd384be79e8c49d0d0bccd22589098809.tar.gz |
Merge pull request #469 from mcuadros/fix-multiple-ack
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 } |