diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-06-23 13:33:34 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-06-23 13:33:34 +0200 |
| commit | 2488de286c0f73b31e95820835767adc3d2ee101 (patch) | |
| tree | 5d3fb5ecb9b4c9c980d3b80a82c1c3069c6906e3 /clone.go | |
| parent | 53fd8ea011483ce70a16332d877d6efd5bafb369 (diff) | |
| parent | c00a05586b63df56a2c619e456229c1c9f785fa7 (diff) | |
Merge pull request #212 from libgit2/remote-handle
Make the network code use handles
Diffstat (limited to 'clone.go')
| -rw-r--r-- | clone.go | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -28,18 +28,20 @@ func Clone(url string, path string, options *CloneOptions) (*Repository, error) cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) - var copts C.git_clone_options - populateCloneOptions(&copts, options) - defer freeCheckoutOpts(&copts.checkout_opts) + copts := (*C.git_clone_options)(C.calloc(1, C.size_t(unsafe.Sizeof(C.git_clone_options{})))) + populateCloneOptions(copts, options) 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) + ret := C.git_clone(&repo.ptr, curl, cpath, copts) + freeCheckoutOpts(&copts.checkout_opts) + C.free(unsafe.Pointer(copts.checkout_branch)) + C.free(unsafe.Pointer(copts)) + if ret < 0 { return nil, MakeGitError(ret) } |
