diff options
author | Ori Rawlings <orirawlings@gmail.com> | 2017-08-23 21:37:49 -0500 |
---|---|---|
committer | Ori Rawlings <orirawlings@gmail.com> | 2017-09-01 09:17:23 -0500 |
commit | 76efca13092ba245caf15f232f467e68fa1f73ed (patch) | |
tree | e94ed3536e5af8d9201e83de9a7011ab5ac37dad /plumbing/transport/internal/common/common.go | |
parent | 3ca370277427c5d508f0dedacbd559523a305121 (diff) | |
download | go-git-76efca13092ba245caf15f232f467e68fa1f73ed.tar.gz |
Add sideband support for push
Diffstat (limited to 'plumbing/transport/internal/common/common.go')
-rw-r--r-- | plumbing/transport/internal/common/common.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/plumbing/transport/internal/common/common.go b/plumbing/transport/internal/common/common.go index 2db8d54..598c6b1 100644 --- a/plumbing/transport/internal/common/common.go +++ b/plumbing/transport/internal/common/common.go @@ -18,6 +18,7 @@ import ( "gopkg.in/src-d/go-git.v4/plumbing/format/pktline" "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp" "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability" + "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/sideband" "gopkg.in/src-d/go-git.v4/plumbing/transport" "gopkg.in/src-d/go-git.v4/utils/ioutil" ) @@ -298,13 +299,26 @@ func (s *session) ReceivePack(ctx context.Context, req *packp.ReferenceUpdateReq } if !req.Capabilities.Supports(capability.ReportStatus) { - // If we have neither report-status or sideband, we can only + // If we don't have report-status, we can only // check return value error. return nil, s.Command.Close() } + r := s.StdoutContext(ctx) + + var d *sideband.Demuxer + if req.Capabilities.Supports(capability.Sideband64k) { + d = sideband.NewDemuxer(sideband.Sideband64k, r) + } else if req.Capabilities.Supports(capability.Sideband) { + d = sideband.NewDemuxer(sideband.Sideband, r) + } + if d != nil { + d.Progress = req.Progress + r = d + } + report := packp.NewReportStatus() - if err := report.Decode(s.StdoutContext(ctx)); err != nil { + if err := report.Decode(r); err != nil { return nil, err } |