示例#1
0
文件: remote.go 项目: jingweno/git2go
func (o *Remote) SetPushUrl(url string) error {
	curl := C.CString(url)
	defer C.free(unsafe.Pointer(curl))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_remote_set_pushurl(o.ptr, curl)
	if ret < 0 {
		return MakeGitError(ret)
	}
	return nil
}
示例#2
0
func (c *RemoteCollection) SetPushUrl(remote, url string) error {
	curl := C.CString(url)
	defer C.free(unsafe.Pointer(curl))
	cremote := C.CString(remote)
	defer C.free(unsafe.Pointer(cremote))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_remote_set_pushurl(c.repo.ptr, cremote, curl)
	if ret < 0 {
		return MakeGitError(ret)
	}
	return nil
}