Example #1
0
func (repo *Repository) LoadRemote(name string) (*Remote, error) {
	remote := new(Remote)
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	ecode := C.git_remote_load(&remote.git_remote, repo.git_repository, cname)
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return remote, nil
}
Example #2
0
func (repo *Repository) LoadRemote(name string) (*Remote, error) {
	remote := &Remote{}

	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_remote_load(&remote.ptr, repo.ptr, cname)
	if ret < 0 {
		return nil, MakeGitError(ret)
	}
	runtime.SetFinalizer(remote, (*Remote).Free)
	return remote, nil
}