MCPcopy Create free account
hub / github.com/go-git/go-git / newReferenceUpdateRequest

Method newReferenceUpdateRequest

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

Source from the content-addressed store, hash-verified

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