From 05a41f164ce918e43bb81ed038014d63de81945f Mon Sep 17 00:00:00 2001 From: Michael Boulton Date: Tue, 18 Aug 2020 08:16:29 +0100 Subject: [PATCH] Move os thread lock to outer scope in defaultapplyoptions --- diff.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/diff.go b/diff.go index 42fc7b5..fb29f49 100644 --- a/diff.go +++ b/diff.go @@ -916,10 +916,11 @@ func deltaApplyCallback(_delta *C.git_diff_delta, _payload unsafe.Pointer) C.int func DefaultApplyOptions() (*ApplyOptions, error) { opts := C.git_apply_options{} + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ecode := C.git_apply_options_init(&opts, C.GIT_APPLY_OPTIONS_VERSION) if int(ecode) != 0 { - runtime.LockOSThread() - defer runtime.UnlockOSThread() return nil, MakeGitError(ecode) }