diff options
Diffstat (limited to 'checkout.go')
| -rw-r--r-- | checkout.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/checkout.go b/checkout.go index 92ced9e..f4c1d4e 100644 --- a/checkout.go +++ b/checkout.go @@ -1,7 +1,6 @@ package git /* -#cgo pkg-config: libgit2 #include <git2.h> git_checkout_opts git_checkout_opts_init() { git_checkout_opts ret = GIT_CHECKOUT_OPTS_INIT; @@ -10,6 +9,7 @@ git_checkout_opts git_checkout_opts_init() { */ import "C" import ( + "runtime" "os" ) @@ -60,6 +60,9 @@ func (v *Repository) Checkout(opts *CheckoutOpts) error { var copts C.git_checkout_opts populateCheckoutOpts(&copts, opts) + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_checkout_head(v.ptr, &copts) if ret < 0 { return LastError() @@ -73,6 +76,9 @@ func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error { var copts C.git_checkout_opts populateCheckoutOpts(&copts, opts) + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_checkout_index(v.ptr, index.ptr, &copts) if ret < 0 { return LastError() |
