예제 #1
0
파일: branch.go 프로젝트: jgrocho/go-git2
func (repo *Repository) DeleteBranch(name string, flag BranchType) error {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	cflag := C.git_branch_t(flag)
	ecode := C.git_branch_delete(repo.git_repository, cname, cflag)
	if ecode != git_SUCCESS {
		return gitError()
	}
	return nil
}
예제 #2
0
파일: branch.go 프로젝트: jingweno/git2go
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
}
예제 #3
0
파일: branch.go 프로젝트: jezell/git2go
func (repo *Repository) NewBranchIterator(flags BranchType) (*BranchIterator, error) {
	refType := C.git_branch_t(flags)
	var ptr *C.git_branch_iterator

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ecode := C.git_branch_iterator_new(&ptr, repo.ptr, refType)
	if ecode < 0 {
		return nil, MakeGitError(ecode)
	}

	return newBranchIteratorFromC(repo, ptr), nil
}
예제 #4
0
파일: branch.go 프로젝트: jezell/git2go
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
}