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 }
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 }
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 }
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 }