( o *PushOptions, localRefs []*plumbing.Reference, remoteRefs storer.ReferenceStorer, ar *packp.AdvRefs, )
| 307 | } |
| 308 | |
| 309 | func (r *Remote) newReferenceUpdateRequest( |
| 310 | o *PushOptions, |
| 311 | localRefs []*plumbing.Reference, |
| 312 | remoteRefs storer.ReferenceStorer, |
| 313 | ar *packp.AdvRefs, |
| 314 | ) (*packp.ReferenceUpdateRequest, error) { |
| 315 | req := packp.NewReferenceUpdateRequestFromCapabilities(ar.Capabilities) |
| 316 | |
| 317 | if o.Progress != nil { |
| 318 | req.Progress = o.Progress |
| 319 | if ar.Capabilities.Supports(capability.Sideband64k) { |
| 320 | _ = req.Capabilities.Set(capability.Sideband64k) |
| 321 | } else if ar.Capabilities.Supports(capability.Sideband) { |
| 322 | _ = req.Capabilities.Set(capability.Sideband) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | if ar.Capabilities.Supports(capability.PushOptions) { |
| 327 | _ = req.Capabilities.Set(capability.PushOptions) |
| 328 | for k, v := range o.Options { |
| 329 | req.Options = append(req.Options, &packp.Option{Key: k, Value: v}) |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | if o.Atomic && ar.Capabilities.Supports(capability.Atomic) { |
| 334 | _ = req.Capabilities.Set(capability.Atomic) |
| 335 | } |
| 336 | |
| 337 | if err := r.addReferencesToUpdate(o.RefSpecs, localRefs, remoteRefs, req, o.Prune, o.ForceWithLease); err != nil { |
| 338 | |
| 339 | return nil, err |
| 340 | } |
| 341 | |
| 342 | if o.FollowTags { |
| 343 | if err := r.addReachableTags(localRefs, remoteRefs, req); err != nil { |
| 344 | return nil, err |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | return req, nil |
| 349 | } |
| 350 | |
| 351 | func (r *Remote) updateRemoteReferenceStorage( |
| 352 | req *packp.ReferenceUpdateRequest, |
no test coverage detected