summaryrefslogtreecommitdiff
path: root/remote.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2016-02-15 15:02:19 +0100
committerCarlos Martín Nieto <[email protected]>2016-02-15 15:02:19 +0100
commit6d6736b2bd4e23a68fa5e0703ab9cf20f3f32af3 (patch)
tree5944351daa7480f7e1a89c46b147701a88dfe697 /remote.go
parent6d60e0f2c911b939f2ccae5d3f7d4c554a4d563e (diff)
parent55594814c9009f9d645aea39a9f917cf82666228 (diff)
Merge remote-tracking branch 'upstream/master' into next
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/remote.go b/remote.go
index a216513..8a57280 100644
--- a/remote.go
+++ b/remote.go
@@ -637,15 +637,17 @@ func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error
crefspecs.strings = makeCStringsFromStrings(refspecs)
defer freeStrarray(&crefspecs)
- var coptions C.git_fetch_options
- populateFetchOptions(&coptions, opts)
+ coptions := (*C.git_fetch_options)(C.calloc(1, C.size_t(unsafe.Sizeof(C.git_fetch_options{}))))
+ defer C.free(unsafe.Pointer(coptions))
+
+ populateFetchOptions(coptions, opts)
defer untrackCalbacksPayload(&coptions.callbacks)
defer freeStrarray(&coptions.custom_headers)
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_remote_fetch(o.ptr, &crefspecs, &coptions, cmsg)
+ ret := C.git_remote_fetch(o.ptr, &crefspecs, coptions, cmsg)
if ret < 0 {
return MakeGitError(ret)
}
@@ -737,15 +739,17 @@ func (o *Remote) Push(refspecs []string, opts *PushOptions) error {
crefspecs.strings = makeCStringsFromStrings(refspecs)
defer freeStrarray(&crefspecs)
- var coptions C.git_push_options
- populatePushOptions(&coptions, opts)
+ coptions := (*C.git_push_options)(C.calloc(1, C.size_t(unsafe.Sizeof(C.git_push_options{}))))
+ defer C.free(unsafe.Pointer(coptions))
+
+ populatePushOptions(coptions, opts)
defer untrackCalbacksPayload(&coptions.callbacks)
defer freeStrarray(&coptions.custom_headers)
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_remote_push(o.ptr, &crefspecs, &coptions)
+ ret := C.git_remote_push(o.ptr, &crefspecs, coptions)
if ret < 0 {
return MakeGitError(ret)
}