summaryrefslogtreecommitdiff
path: root/clone.go
diff options
context:
space:
mode:
authorJason Toffaletti <[email protected]>2014-01-06 20:05:35 +0000
committerJason Toffaletti <[email protected]>2014-01-06 20:05:35 +0000
commit32bf5f0a234e0c3cd00dc8eec349ee820f765f19 (patch)
treef118a770bb7eb0cd83a049a80f8cce3975489143 /clone.go
parentd1245446685ccdc632b6a9cee65391cbe4eac4df (diff)
wip wrapping git_remote
Diffstat (limited to 'clone.go')
-rw-r--r--clone.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/clone.go b/clone.go
index 672c325..425e179 100644
--- a/clone.go
+++ b/clone.go
@@ -37,6 +37,17 @@ func Clone(url string, path string, options *CloneOptions) (*Repository, error)
var copts C.git_clone_options
populateCloneOptions(&copts, options)
+ // finish populating clone options here so we can defer CString free
+ if len(options.RemoteName) != 0 {
+ copts.remote_name = C.CString(options.RemoteName)
+ defer C.free(unsafe.Pointer(copts.remote_name))
+ }
+
+ if len(options.CheckoutBranch) != 0 {
+ copts.checkout_branch = C.CString(options.CheckoutBranch)
+ defer C.free(unsafe.Pointer(copts.checkout_branch))
+ }
+
runtime.LockOSThread()
defer runtime.UnlockOSThread()
ret := C.git_clone(&repo.ptr, curl, cpath, &copts)