| 164 | } |
| 165 | |
| 166 | func (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 | |
| 183 | func (b *Branch) Name() (string, error) { |
| 184 | var cName *C.char |