From 6118c9ba37f494cbb892aa686416280ae6ee6593 Mon Sep 17 00:00:00 2001 From: ezwiebel Date: Wed, 23 Nov 2016 17:10:59 +1100 Subject: LockOSThread in CurrentOperationIndex for git error creation --- rebase.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rebase.go') diff --git a/rebase.go b/rebase.go index 8384d68..8553e25 100644 --- a/rebase.go +++ b/rebase.go @@ -145,16 +145,21 @@ func (r *Repository) OpenRebase(opts *RebaseOptions) (*Rebase, error) { // OperationAt gets the rebase operation specified by the given index. func (rebase *Rebase) OperationAt(index uint) *RebaseOperation { operation := C.git_rebase_operation_byindex(rebase.ptr, C.size_t(index)) + return newRebaseOperationFromC(operation) } // CurrentOperationIndex gets the index of the rebase operation that is currently being applied. // Returns an error if no rebase operation is currently applied. func (rebase *Rebase) CurrentOperationIndex() (uint, error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + operationIndex := int(C.git_rebase_operation_current(rebase.ptr)) if operationIndex == C.GIT_REBASE_NO_OPERATION { return 0, MakeGitError(C.GIT_REBASE_NO_OPERATION) } + return uint(operationIndex), nil } -- cgit v1.2.3