OpenRebase opens an existing rebase that was previously started by either an invocation of InitRebase or by another client.
(opts *RebaseOptions)
| 323 | |
| 324 | // OpenRebase opens an existing rebase that was previously started by either an invocation of InitRebase or by another client. |
| 325 | func (r *Repository) OpenRebase(opts *RebaseOptions) (*Rebase, error) { |
| 326 | runtime.LockOSThread() |
| 327 | defer runtime.UnlockOSThread() |
| 328 | |
| 329 | var ptr *C.git_rebase |
| 330 | var err error |
| 331 | cOpts := populateRebaseOptions(&C.git_rebase_options{}, opts, r, &err) |
| 332 | ret := C.git_rebase_open(&ptr, r.ptr, cOpts) |
| 333 | runtime.KeepAlive(r) |
| 334 | if ret == C.int(ErrorCodeUser) && err != nil { |
| 335 | freeRebaseOptions(cOpts) |
| 336 | return nil, err |
| 337 | } |
| 338 | if ret < 0 { |
| 339 | freeRebaseOptions(cOpts) |
| 340 | return nil, MakeGitError(ret) |
| 341 | } |
| 342 | |
| 343 | return newRebaseFromC(ptr, r, cOpts), nil |
| 344 | } |
| 345 | |
| 346 | // OperationAt gets the rebase operation specified by the given index. |
| 347 | func (rebase *Rebase) OperationAt(index uint) *RebaseOperation { |