summaryrefslogtreecommitdiff
path: root/clone.go
diff options
context:
space:
mode:
Diffstat (limited to 'clone.go')
-rw-r--r--clone.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/clone.go b/clone.go
index 425e179..630c343 100644
--- a/clone.go
+++ b/clone.go
@@ -19,20 +19,20 @@ import (
type CloneOptions struct {
*CheckoutOpts
*RemoteCallbacks
- Bare bool
+ Bare bool
IgnoreCertErrors bool
- RemoteName string
- CheckoutBranch string
+ RemoteName string
+ CheckoutBranch string
}
func Clone(url string, path string, options *CloneOptions) (*Repository, error) {
repo := new(Repository)
- curl := C.CString(url)
- defer C.free(unsafe.Pointer(curl))
+ curl := C.CString(url)
+ defer C.free(unsafe.Pointer(curl))
- cpath := C.CString(path)
- defer C.free(unsafe.Pointer(cpath))
+ cpath := C.CString(path)
+ defer C.free(unsafe.Pointer(cpath))
var copts C.git_clone_options
populateCloneOptions(&copts, options)
@@ -52,7 +52,7 @@ func Clone(url string, path string, options *CloneOptions) (*Repository, error)
defer runtime.UnlockOSThread()
ret := C.git_clone(&repo.ptr, curl, cpath, &copts)
if ret < 0 {
- return nil, LastError()
+ return nil, MakeGitError(ret)
}
runtime.SetFinalizer(repo, (*Repository).Free)
@@ -77,4 +77,3 @@ func populateCloneOptions(ptr *C.git_clone_options, opts *CloneOptions) {
ptr.ignore_cert_errors = 0
}
}
-