MCPcopy Create free account
hub / github.com/libgit2/git2go / MergeBaseMany

Method MergeBaseMany

merge.go:355–372  ·  view source on GitHub ↗

MergeBaseMany finds a merge base given a list of commits.

(oids []*Oid)

Source from the content-addressed store, hash-verified

353
354// MergeBaseMany finds a merge base given a list of commits.
355func (r *Repository) MergeBaseMany(oids []*Oid) (*Oid, error) {
356 coids := make([]C.git_oid, len(oids))
357 for i := 0; i < len(oids); i++ {
358 coids[i] = *oids[i].toC()
359 }
360
361 runtime.LockOSThread()
362 defer runtime.UnlockOSThread()
363
364 var oid C.git_oid
365 ret := C.git_merge_base_many(&oid, r.ptr, C.size_t(len(oids)), &coids[0])
366 runtime.KeepAlive(r)
367 runtime.KeepAlive(coids)
368 if ret < 0 {
369 return nil, MakeGitError(ret)
370 }
371 return newOidFromC(&oid), nil
372}
373
374// MergeBasesMany finds all merge bases given a list of commits.
375func (r *Repository) MergeBasesMany(oids []*Oid) ([]*Oid, error) {

Callers 1

TestMergeBaseManyFunction · 0.80

Calls 3

MakeGitErrorFunction · 0.85
newOidFromCFunction · 0.85
toCMethod · 0.45

Tested by 1

TestMergeBaseManyFunction · 0.64