| 77 | } |
| 78 | |
| 79 | func (r *Repository) CherrypickCommit(pick, our *Commit, opts CherrypickOptions) (*Index, error) { |
| 80 | runtime.LockOSThread() |
| 81 | defer runtime.UnlockOSThread() |
| 82 | |
| 83 | cOpts := populateMergeOptions(&C.git_merge_options{}, &opts.MergeOptions) |
| 84 | defer freeMergeOptions(cOpts) |
| 85 | |
| 86 | var ptr *C.git_index |
| 87 | ret := C.git_cherrypick_commit(&ptr, r.ptr, pick.cast_ptr, our.cast_ptr, C.uint(opts.Mainline), cOpts) |
| 88 | runtime.KeepAlive(pick) |
| 89 | runtime.KeepAlive(our) |
| 90 | if ret < 0 { |
| 91 | return nil, MakeGitError(ret) |
| 92 | } |
| 93 | return newIndexFromC(ptr, r), nil |
| 94 | } |