summaryrefslogtreecommitdiff
path: root/checkout.go
diff options
context:
space:
mode:
Diffstat (limited to 'checkout.go')
-rw-r--r--checkout.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/checkout.go b/checkout.go
index f5822c9..db3118f 100644
--- a/checkout.go
+++ b/checkout.go
@@ -188,6 +188,7 @@ func (v *Repository) CheckoutHead(opts *CheckoutOpts) error {
defer freeCheckoutOpts(cOpts)
ret := C.git_checkout_head(v.ptr, cOpts)
+ runtime.KeepAlive(v)
if ret < 0 {
return MakeGitError(ret)
}
@@ -211,6 +212,7 @@ func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error {
defer freeCheckoutOpts(cOpts)
ret := C.git_checkout_index(v.ptr, iptr, cOpts)
+ runtime.KeepAlive(v)
if ret < 0 {
return MakeGitError(ret)
}
@@ -226,6 +228,7 @@ func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOpts) error {
defer freeCheckoutOpts(cOpts)
ret := C.git_checkout_tree(v.ptr, tree.ptr, cOpts)
+ runtime.KeepAlive(v)
if ret < 0 {
return MakeGitError(ret)
}