summaryrefslogtreecommitdiff
path: root/checkout.go
diff options
context:
space:
mode:
authorMirko Nosenzo <[email protected]>2016-06-25 11:30:35 +0200
committerMirko Nosenzo <[email protected]>2016-06-25 11:39:44 +0200
commit6fa4c8ea15887c9a8fc96e9d052112a4ef5170cd (patch)
tree7be1cc7b1681c7598d46ffb581dc7a0354e5f084 /checkout.go
parent18802c24e363d7f4982af86a3e9be437cb8585b2 (diff)
Checkout Payload Pointer Fix
- Tracking pointer once - Tracking pointer and not struct
Diffstat (limited to 'checkout.go')
-rw-r--r--checkout.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/checkout.go b/checkout.go
index 7377d51..a511306 100644
--- a/checkout.go
+++ b/checkout.go
@@ -74,10 +74,10 @@ func checkoutOptionsFromC(c *C.git_checkout_options) CheckoutOpts {
opts.FileOpenFlags = int(c.file_open_flags)
opts.NotifyFlags = CheckoutNotifyType(c.notify_flags)
if c.notify_payload != nil {
- opts.NotifyCallback = pointerHandles.Get(c.notify_payload).(CheckoutOpts).NotifyCallback
+ opts.NotifyCallback = pointerHandles.Get(c.notify_payload).(*CheckoutOpts).NotifyCallback
}
if c.progress_payload != nil {
- opts.ProgressCallback = pointerHandles.Get(c.progress_payload).(CheckoutOpts).ProgressCallback
+ opts.ProgressCallback = pointerHandles.Get(c.progress_payload).(*CheckoutOpts).ProgressCallback
}
if c.target_directory != nil {
opts.TargetDirectory = C.GoString(c.target_directory)
@@ -110,7 +110,7 @@ func checkoutNotifyCallback(why C.git_checkout_notify_t, cpath *C.char, cbaselin
if cworkdir != nil {
workdir = diffFileFromC((*C.git_diff_file)(cworkdir))
}
- opts := pointerHandles.Get(data).(CheckoutOpts)
+ opts := pointerHandles.Get(data).(*CheckoutOpts)
if opts.NotifyCallback == nil {
return 0
}
@@ -122,7 +122,7 @@ func checkoutProgressCallback(path *C.char, completed_steps, total_steps C.size_
if data == nil {
return 0
}
- opts := pointerHandles.Get(data).(CheckoutOpts)
+ opts := pointerHandles.Get(data).(*CheckoutOpts)
if opts.ProgressCallback == nil {
return 0
}
@@ -146,11 +146,12 @@ func populateCheckoutOpts(ptr *C.git_checkout_options, opts *CheckoutOpts) *C.gi
if opts.NotifyCallback != nil || opts.ProgressCallback != nil {
C._go_git_populate_checkout_cb(ptr)
}
+ payload := pointerHandles.Track(opts)
if opts.NotifyCallback != nil {
- ptr.notify_payload = pointerHandles.Track(*opts)
+ ptr.notify_payload = payload
}
if opts.ProgressCallback != nil {
- ptr.progress_payload = pointerHandles.Track(*opts)
+ ptr.progress_payload = payload
}
if opts.TargetDirectory != "" {
ptr.target_directory = C.CString(opts.TargetDirectory)
@@ -178,9 +179,6 @@ func freeCheckoutOpts(ptr *C.git_checkout_options) {
if ptr.notify_payload != nil {
pointerHandles.Untrack(ptr.notify_payload)
}
- if ptr.progress_payload != nil {
- pointerHandles.Untrack(ptr.progress_payload)
- }
}
// Updates files in the index and the working tree to match the content of