@@ -65,7 +65,6 @@ func (r *Remote) Push(o *PushOptions) error {
6565// operation is complete, an error is returned. The context only affects to the
6666// transport operations.
6767func (r * Remote ) PushContext (ctx context.Context , o * PushOptions ) error {
68- // TODO: Sideband support
6968 if err := o .Validate (); err != nil {
7069 return err
7170 }
@@ -108,9 +107,8 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) error {
108107 return ErrDeleteRefNotSupported
109108 }
110109
111- req := packp .NewReferenceUpdateRequestFromCapabilities (ar .Capabilities )
112- if err := r .addReferencesToUpdate (o .RefSpecs , remoteRefs , req ); err != nil {
113-
110+ req , err := r .newReferenceUpdateRequest (o , remoteRefs , ar )
111+ if err != nil {
114112 return err
115113 }
116114
@@ -158,6 +156,25 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) error {
158156 return r .updateRemoteReferenceStorage (req , rs )
159157}
160158
159+ func (r * Remote ) newReferenceUpdateRequest (o * PushOptions , remoteRefs storer.ReferenceStorer , ar * packp.AdvRefs ) (* packp.ReferenceUpdateRequest , error ) {
160+ req := packp .NewReferenceUpdateRequestFromCapabilities (ar .Capabilities )
161+
162+ if o .Progress != nil {
163+ req .Progress = o .Progress
164+ if ar .Capabilities .Supports (capability .Sideband64k ) {
165+ req .Capabilities .Set (capability .Sideband64k )
166+ } else if ar .Capabilities .Supports (capability .Sideband ) {
167+ req .Capabilities .Set (capability .Sideband )
168+ }
169+ }
170+
171+ if err := r .addReferencesToUpdate (o .RefSpecs , remoteRefs , req ); err != nil {
172+ return nil , err
173+ }
174+
175+ return req , nil
176+ }
177+
161178func (r * Remote ) updateRemoteReferenceStorage (
162179 req * packp.ReferenceUpdateRequest ,
163180 result * packp.ReportStatus ,
0 commit comments