Merge pull request #116 from calavera/sync_with_libgit2_master
Sync with libgit2 master.
This commit is contained in:
commit
756c8a7e8b
23
clone.go
23
clone.go
|
@ -15,9 +15,9 @@ type CloneOptions struct {
|
||||||
*CheckoutOpts
|
*CheckoutOpts
|
||||||
*RemoteCallbacks
|
*RemoteCallbacks
|
||||||
Bare bool
|
Bare bool
|
||||||
IgnoreCertErrors bool
|
|
||||||
RemoteName string
|
|
||||||
CheckoutBranch string
|
CheckoutBranch string
|
||||||
|
RemoteCreateCallback C.git_remote_create_cb
|
||||||
|
RemoteCreatePayload unsafe.Pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
func Clone(url string, path string, options *CloneOptions) (*Repository, error) {
|
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
|
var copts C.git_clone_options
|
||||||
populateCloneOptions(&copts, 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 {
|
if len(options.CheckoutBranch) != 0 {
|
||||||
copts.checkout_branch = C.CString(options.CheckoutBranch)
|
copts.checkout_branch = C.CString(options.CheckoutBranch)
|
||||||
defer C.free(unsafe.Pointer(copts.checkout_branch))
|
defer C.free(unsafe.Pointer(copts.checkout_branch))
|
||||||
|
@ -67,9 +61,14 @@ func populateCloneOptions(ptr *C.git_clone_options, opts *CloneOptions) {
|
||||||
} else {
|
} else {
|
||||||
ptr.bare = 0
|
ptr.bare = 0
|
||||||
}
|
}
|
||||||
if opts.IgnoreCertErrors {
|
|
||||||
ptr.ignore_cert_errors = 1
|
if opts.RemoteCreateCallback != nil {
|
||||||
} else {
|
ptr.remote_cb = opts.RemoteCreateCallback
|
||||||
ptr.ignore_cert_errors = 0
|
defer C.free(unsafe.Pointer(opts.RemoteCreateCallback))
|
||||||
|
|
||||||
|
if opts.RemoteCreatePayload != nil {
|
||||||
|
ptr.remote_cb_payload = opts.RemoteCreatePayload
|
||||||
|
defer C.free(opts.RemoteCreatePayload)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
tree.go
3
tree.go
|
@ -16,8 +16,7 @@ import (
|
||||||
type Filemode int
|
type Filemode int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FilemodeNew Filemode = C.GIT_FILEMODE_NEW
|
FilemodeTree Filemode = C.GIT_FILEMODE_TREE
|
||||||
FilemodeTree = C.GIT_FILEMODE_TREE
|
|
||||||
FilemodeBlob = C.GIT_FILEMODE_BLOB
|
FilemodeBlob = C.GIT_FILEMODE_BLOB
|
||||||
FilemodeBlobExecutable = C.GIT_FILEMODE_BLOB_EXECUTABLE
|
FilemodeBlobExecutable = C.GIT_FILEMODE_BLOB_EXECUTABLE
|
||||||
FilemodeLink = C.GIT_FILEMODE_LINK
|
FilemodeLink = C.GIT_FILEMODE_LINK
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b4d00c1d2466de3558a7cc6983dce4eb2ee98431
|
Subproject commit 89e05e2ab19ac452e84e0eaa2dfb8e07ac6839bf
|
Loading…
Reference in New Issue