MCPcopy Create free account
hub / github.com/libgit2/git2go / LookupBranch

Method LookupBranch

branch.go:166–181  ·  view source on GitHub ↗
(branchName string, bt BranchType)

Source from the content-addressed store, hash-verified

164}
165
166func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch, error) {
167 var ptr *C.git_reference
168
169 cName := C.CString(branchName)
170 defer C.free(unsafe.Pointer(cName))
171
172 runtime.LockOSThread()
173 defer runtime.UnlockOSThread()
174
175 ret := C.git_branch_lookup(&ptr, repo.ptr, cName, C.git_branch_t(bt))
176 runtime.KeepAlive(repo)
177 if ret < 0 {
178 return nil, MakeGitError(ret)
179 }
180 return newReferenceFromC(ptr, repo).Branch(), nil
181}
182
183func (b *Branch) Name() (string, error) {
184 var cName *C.char

Callers 2

performRebaseOntoFunction · 0.80

Calls 4

MakeGitErrorFunction · 0.85
newReferenceFromCFunction · 0.85
freeMethod · 0.80
BranchMethod · 0.80

Tested by 2

performRebaseOntoFunction · 0.64