aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/uppackresp.go
diff options
context:
space:
mode:
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
}