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

Method MergeCommits

merge.go:266–282  ·  view source on GitHub ↗
(ours *Commit, theirs *Commit, options *MergeOptions)

Source from the content-addressed store, hash-verified

264}
265
266func (r *Repository) MergeCommits(ours *Commit, theirs *Commit, options *MergeOptions) (*Index, error) {
267 runtime.LockOSThread()
268 defer runtime.UnlockOSThread()
269
270 copts := populateMergeOptions(&C.git_merge_options{}, options)
271 defer freeMergeOptions(copts)
272
273 var ptr *C.git_index
274 ret := C.git_merge_commits(&ptr, r.ptr, ours.cast_ptr, theirs.cast_ptr, copts)
275 runtime.KeepAlive(ours)
276 runtime.KeepAlive(theirs)
277 if ret < 0 {
278 return nil, MakeGitError(ret)
279 }
280
281 return newIndexFromC(ptr, r), nil
282}
283
284func (r *Repository) MergeTrees(ancestor *Tree, ours *Tree, theirs *Tree, options *MergeOptions) (*Index, error) {
285 runtime.LockOSThread()

Callers

nothing calls this directly

Calls 4

populateMergeOptionsFunction · 0.85
freeMergeOptionsFunction · 0.85
MakeGitErrorFunction · 0.85
newIndexFromCFunction · 0.85

Tested by

no test coverage detected