Example #1
0
File: clone.go Project: wid/git2go
func populateCloneOptions(ptr *C.git_clone_options, opts *CloneOptions) {
	C.git_clone_init_options(ptr, C.GIT_CLONE_OPTIONS_VERSION)

	if opts == nil {
		return
	}
	populateCheckoutOpts(&ptr.checkout_opts, opts.CheckoutOpts)
	populateFetchOptions(&ptr.fetch_opts, opts.FetchOptions)
	ptr.bare = cbool(opts.Bare)

	if opts.RemoteCreateCallback != nil {
		// Go v1.1 does not allow to assign a C function pointer
		C._go_git_populate_remote_cb(ptr)
		ptr.remote_cb_payload = pointerHandles.Track(*opts)
	}
}
Example #2
0
func populateCloneOptions(ptr *C.git_clone_options, opts *CloneOptions) {
	C.git_clone_init_options(ptr, C.GIT_CLONE_OPTIONS_VERSION)

	if opts == nil {
		return
	}
	populateCheckoutOpts(&ptr.checkout_opts, opts.CheckoutOpts)
	populateRemoteCallbacks(&ptr.remote_callbacks, opts.RemoteCallbacks)
	if opts.Bare {
		ptr.bare = 1
	} else {
		ptr.bare = 0
	}
	if opts.IgnoreCertErrors {
		ptr.ignore_cert_errors = 1
	} else {
		ptr.ignore_cert_errors = 0
	}
}
Example #3
0
func populateCloneOptions(ptr *C.git_clone_options, opts *CloneOptions) {
	C.git_clone_init_options(ptr, C.GIT_CLONE_OPTIONS_VERSION)

	if opts == nil {
		return
	}
	populateCheckoutOpts(&ptr.checkout_opts, opts.CheckoutOpts)
	populateRemoteCallbacks(&ptr.remote_callbacks, opts.RemoteCallbacks)
	ptr.bare = cbool(opts.Bare)

	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)
		}
	}
}