aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/uppackresp.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-07-11 01:41:37 -0700
committerGitHub <noreply@github.com>2017-07-11 01:41:37 -0700
commit09cd5ccfd384be79e8c49d0d0bccd22589098809 (patch)
tree5c8537c62e7a5fb35c57cd572aa25f9f55f54441 /plumbing/protocol/packp/uppackresp.go
parent6b69a1630b30c41f4563fd95aca1d647ba611adf (diff)
parenta3dc077738fc55629f22e4effd389385a49f68cc (diff)
downloadgo-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.go10
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
}