func (r *UploadPackResponse) Decode(reader io.ReadCloser) error {
	buf := bufio.NewReader(reader)
	if r.isShallow {
		if err := r.ShallowUpdate.Decode(buf); err != nil {
			return err
		}
	}
	if err := r.ServerResponse.Decode(buf, r.isMultiACK); err != nil {
		return err
	}
	r.r = ioutil.NewReadCloser(buf, reader)
	return nil
}
Decode decodes all the responses sent by upload-pack service into the struct
and prepares it to read the packfile using the Read method
package packp
import (
	"errors"
	"io"
	"bufio"
	"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
	"gopkg.in/src-d/go-git.v4/utils/ioutil"
)
var ErrUploadPackResponseNotDecoded = errors.New("upload-pack-response should be decoded")
type UploadPackResponse struct {
	ShallowUpdate
	ServerResponse
	r          io.ReadCloser
	isShallow  bool
	isMultiACK bool
	isOk       bool
}
func NewUploadPackResponse(req *UploadPackRequest) *UploadPackResponse {
	isShallow := !req.Depth.IsZero()
	isMultiACK := req.Capabilities.Supports(capability.MultiACK) ||
		req.Capabilities.Supports(capability.MultiACKDetailed)
	return &UploadPackResponse{
		isShallow:  isShallow,
		isMultiACK: isMultiACK,
	}
}
func NewUploadPackResponseWithPackfile(req *UploadPackRequest,
	pf io.ReadCloser) *UploadPackResponse {
	r := NewUploadPackResponse(req)
	r.r = pf
	return r
}