當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.git_clone_options類代碼示例

本文整理匯總了Golang中C.git_clone_options的典型用法代碼示例。如果您正苦於以下問題:Golang git_clone_options類的具體用法?Golang git_clone_options怎麽用?Golang git_clone_options使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了git_clone_options類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Clone

func Clone(url string, path string, options *CloneOptions) (*Repository, error) {
	repo := new(Repository)

	curl := C.CString(url)
	defer C.free(unsafe.Pointer(curl))

	cpath := C.CString(path)
	defer C.free(unsafe.Pointer(cpath))

	var copts C.git_clone_options
	populateCloneOptions(&copts, options)
	defer freeCheckoutOpts(&copts.checkout_opts)

	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)
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	runtime.SetFinalizer(repo, (*Repository).Free)
	return repo, nil
}
開發者ID:jezell,項目名稱:git2go,代碼行數:28,代碼來源:clone.go

示例2: populateCloneOptions

func populateCloneOptions(ptr *C.git_clone_options, opts *CloneOpts) {
	ptr.version = 1

	checkout := C.git_checkout_opts_init()
	populateCheckoutOpts(&checkout, &opts.Checkout)
	ptr.checkout_opts = checkout
}
開發者ID:bradhe,項目名稱:git2go,代碼行數:7,代碼來源:checkout.go

示例3: populateCloneOptions

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)
	}
}
開發者ID:wid,項目名稱:git2go,代碼行數:16,代碼來源:clone.go

示例4: populateCloneOptions

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
	}
}
開發者ID:jingweno,項目名稱:git2go,代碼行數:19,代碼來源:clone.go

示例5: populateCloneOptions

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)
		}
	}
}
開發者ID:jezell,項目名稱:git2go,代碼行數:20,代碼來源:clone.go


注:本文中的C.git_clone_options類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。