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

Method CherrypickCommit

cherrypick.go:79–94  ·  view source on GitHub ↗
(pick, our *Commit, opts CherrypickOptions)

Source from the content-addressed store, hash-verified

77}
78
79func (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}

Callers 1

TestCherrypickCommitFunction · 0.80

Calls 4

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

Tested by 1

TestCherrypickCommitFunction · 0.64