Ejemplo n.º 1
0
func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch, error) {
	branch := new(Branch)
	cName := C.CString(branchName)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_branch_lookup(&branch.ptr, repo.ptr, cName, C.git_branch_t(bt))
	if ret < 0 {
		return nil, MakeGitError(ret)
	}
	return branch, nil
}
Ejemplo n.º 2
0
func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch, error) {
	var ptr *C.git_reference

	cName := C.CString(branchName)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_branch_lookup(&ptr, repo.ptr, cName, C.git_branch_t(bt))
	if ret < 0 {
		return nil, MakeGitError(ret)
	}
	return newReferenceFromC(ptr, repo).Branch(), nil
}