RevertCommit reverts the provided commit against "ourCommit" The returned index contains the result of the revert and should be freed
(revertCommit *Commit, ourCommit *Commit, mainline uint, mergeOptions *MergeOptions)
| 84 | // RevertCommit reverts the provided commit against "ourCommit" |
| 85 | // The returned index contains the result of the revert and should be freed |
| 86 | func (r *Repository) RevertCommit(revertCommit *Commit, ourCommit *Commit, mainline uint, mergeOptions *MergeOptions) (*Index, error) { |
| 87 | runtime.LockOSThread() |
| 88 | defer runtime.UnlockOSThread() |
| 89 | |
| 90 | cOpts := populateMergeOptions(&C.git_merge_options{}, mergeOptions) |
| 91 | defer freeMergeOptions(cOpts) |
| 92 | |
| 93 | var index *C.git_index |
| 94 | |
| 95 | ecode := C.git_revert_commit(&index, r.ptr, revertCommit.cast_ptr, ourCommit.cast_ptr, C.uint(mainline), cOpts) |
| 96 | runtime.KeepAlive(revertCommit) |
| 97 | runtime.KeepAlive(ourCommit) |
| 98 | |
| 99 | if ecode < 0 { |
| 100 | return nil, MakeGitError(ecode) |
| 101 | } |
| 102 | |
| 103 | return newIndexFromC(index, r), nil |
| 104 | } |