summaryrefslogtreecommitdiff
path: root/clone.go
diff options
context:
space:
mode:
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)