diff options
| author | David Calavera <[email protected]> | 2014-09-03 18:08:48 -0700 |
|---|---|---|
| committer | David Calavera <[email protected]> | 2014-09-03 18:08:48 -0700 |
| commit | 9bec36a0b070fc0b4ae444865a95c8e02afe0b69 (patch) | |
| tree | 97e78df93fdfc0026aef9c285546c427f97c3a88 /clone.go | |
| parent | 84597241e0636c7b56ae88167940b029680784e8 (diff) | |
Update clone options to be in sync with libgit2 master.
Remove missing constants.
Diffstat (limited to 'clone.go')
| -rw-r--r-- | clone.go | 27 |
1 files changed, 13 insertions, 14 deletions
@@ -14,10 +14,10 @@ import ( type CloneOptions struct { *CheckoutOpts *RemoteCallbacks - Bare bool - IgnoreCertErrors bool - RemoteName string - CheckoutBranch string + Bare bool + CheckoutBranch string + RemoteCreateCallback C.git_remote_create_cb + RemoteCreatePayload unsafe.Pointer } func Clone(url string, path string, options *CloneOptions) (*Repository, error) { @@ -32,12 +32,6 @@ 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)) @@ -67,9 +61,14 @@ func populateCloneOptions(ptr *C.git_clone_options, opts *CloneOptions) { } else { ptr.bare = 0 } - if opts.IgnoreCertErrors { - ptr.ignore_cert_errors = 1 - } else { - ptr.ignore_cert_errors = 0 + + if opts.RemoteCreateCallback != nil { + ptr.remote_cb = opts.RemoteCreateCallback + defer C.free(unsafe.Pointer(opts.RemoteCreateCallback)) + + if opts.RemoteCreatePayload != nil { + ptr.remote_cb_payload = opts.RemoteCreatePayload + defer C.free(opts.RemoteCreatePayload) + } } } |
