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

Method MergeTrees

merge.go:284–305  ·  view source on GitHub ↗
(ancestor *Tree, ours *Tree, theirs *Tree, options *MergeOptions)

Source from the content-addressed store, hash-verified

282}
283
284func (r *Repository) MergeTrees(ancestor *Tree, ours *Tree, theirs *Tree, options *MergeOptions) (*Index, error) {
285 runtime.LockOSThread()
286 defer runtime.UnlockOSThread()
287
288 copts := populateMergeOptions(&C.git_merge_options{}, options)
289 defer freeMergeOptions(copts)
290
291 var ancestor_ptr *C.git_tree
292 if ancestor != nil {
293 ancestor_ptr = ancestor.cast_ptr
294 }
295 var ptr *C.git_index
296 ret := C.git_merge_trees(&ptr, r.ptr, ancestor_ptr, ours.cast_ptr, theirs.cast_ptr, copts)
297 runtime.KeepAlive(ancestor)
298 runtime.KeepAlive(ours)
299 runtime.KeepAlive(theirs)
300 if ret < 0 {
301 return nil, MakeGitError(ret)
302 }
303
304 return newIndexFromC(ptr, r), nil
305}
306
307func (r *Repository) MergeBase(one *Oid, two *Oid) (*Oid, error) {
308 runtime.LockOSThread()

Callers 1

Calls 4

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

Tested by 1