summaryrefslogtreecommitdiff
path: root/cherrypick.go
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-02-23 08:08:30 -0800
committerGitHub <[email protected]>2020-02-23 08:08:30 -0800
commit45097a857c3df900111d49b9c07f2ad4645c1450 (patch)
tree69ce278737eff6798c18d68e06489b1ad6fda93a /cherrypick.go
parent21d618136f415486d95965e75af80c0e6688a0d5 (diff)
parentc1903b47fe80c7c0a3a9900d730f4dfce7f21aca (diff)
Merge pull request #429 from josharian/cherrypick-commit
cherrypick: wrap git_cherrypick_commit
Diffstat (limited to 'cherrypick.go')
-rw-r--r--cherrypick.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/cherrypick.go b/cherrypick.go
index 8983a7a..e86e940 100644
--- a/cherrypick.go
+++ b/cherrypick.go
@@ -73,3 +73,19 @@ func (v *Repository) Cherrypick(commit *Commit, opts CherrypickOptions) error {
}
return nil
}
+
+func (r *Repository) CherrypickCommit(pick, our *Commit, opts CherrypickOptions) (*Index, error) {
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ cOpts := opts.MergeOpts.toC()
+
+ var ptr *C.git_index
+ ret := C.git_cherrypick_commit(&ptr, r.ptr, pick.cast_ptr, our.cast_ptr, C.uint(opts.Mainline), cOpts)
+ runtime.KeepAlive(pick)
+ runtime.KeepAlive(our)
+ if ret < 0 {
+ return nil, MakeGitError(ret)
+ }
+ return newIndexFromC(ptr, r), nil
+}