| 57 | } |
| 58 | |
| 59 | func (v *Repository) Cherrypick(commit *Commit, opts CherrypickOptions) error { |
| 60 | runtime.LockOSThread() |
| 61 | defer runtime.UnlockOSThread() |
| 62 | |
| 63 | var err error |
| 64 | cOpts := populateCherrypickOptions(&C.git_cherrypick_options{}, &opts, &err) |
| 65 | defer freeCherrypickOpts(cOpts) |
| 66 | |
| 67 | ret := C.git_cherrypick(v.ptr, commit.cast_ptr, cOpts) |
| 68 | runtime.KeepAlive(v) |
| 69 | runtime.KeepAlive(commit) |
| 70 | if ret == C.int(ErrorCodeUser) && err != nil { |
| 71 | return err |
| 72 | } |
| 73 | if ret < 0 { |
| 74 | return MakeGitError(ret) |
| 75 | } |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | func (r *Repository) CherrypickCommit(pick, our *Commit, opts CherrypickOptions) (*Index, error) { |
| 80 | runtime.LockOSThread() |