| 282 | } |
| 283 | |
| 284 | func (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 | |
| 307 | func (r *Repository) MergeBase(one *Oid, two *Oid) (*Oid, error) { |
| 308 | runtime.LockOSThread() |