本文整理匯總了Golang中C.git_clone_options.remote_name方法的典型用法代碼示例。如果您正苦於以下問題:Golang git_clone_options.remote_name方法的具體用法?Golang git_clone_options.remote_name怎麽用?Golang git_clone_options.remote_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類C.git_clone_options
的用法示例。
在下文中一共展示了git_clone_options.remote_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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)
// 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))
}
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
}