MCPcopy
hub / github.com/go-git/go-git / newReferenceUpdateRequest

Method newReferenceUpdateRequest

remote.go:309–349  ·  view source on GitHub ↗
(
	o *PushOptions,
	localRefs []*plumbing.Reference,
	remoteRefs storer.ReferenceStorer,
	ar *packp.AdvRefs,
)

Source from the content-addressed store, hash-verified

307}
308
309func (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
351func (r *Remote) updateRemoteReferenceStorage(
352 req *packp.ReferenceUpdateRequest,

Callers 1

PushContextMethod · 0.95

Calls 5

addReferencesToUpdateMethod · 0.95
addReachableTagsMethod · 0.95
SupportsMethod · 0.80
SetMethod · 0.80

Tested by

no test coverage detected