()
| 42 | } |
| 43 | |
| 44 | func (i *BranchIterator) Next() (*Branch, BranchType, error) { |
| 45 | |
| 46 | runtime.LockOSThread() |
| 47 | defer runtime.UnlockOSThread() |
| 48 | |
| 49 | var refPtr *C.git_reference |
| 50 | var refType C.git_branch_t |
| 51 | |
| 52 | ecode := C.git_branch_next(&refPtr, &refType, i.ptr) |
| 53 | |
| 54 | if ecode < 0 { |
| 55 | return nil, BranchLocal, MakeGitError(ecode) |
| 56 | } |
| 57 | |
| 58 | branch := newReferenceFromC(refPtr, i.repo).Branch() |
| 59 | |
| 60 | return branch, BranchType(refType), nil |
| 61 | } |
| 62 | |
| 63 | func (i *BranchIterator) Free() { |
| 64 | runtime.SetFinalizer(i, nil) |