Add branch iterator #66
|
@ -53,9 +53,7 @@ func (i *BranchIterator) Next() (*Branch, BranchType, error) {
|
||||||
|
|
||||||
ecode := C.git_branch_next(&refPtr, &refType, i.ptr)
|
ecode := C.git_branch_next(&refPtr, &refType, i.ptr)
|
||||||
|
|
||||||
if ecode == C.GIT_ITEROVER {
|
if ecode < 0 {
|
||||||
return nil, BranchLocal, ErrIterOver
|
|
||||||
} else if ecode < 0 {
|
|
||||||
return nil, BranchLocal, MakeGitError(ecode)
|
return nil, BranchLocal, MakeGitError(ecode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ func TestBranchIterator(t *testing.T) {
|
||||||
t.Fatalf("expected BranchLocal, not %v", t)
|
t.Fatalf("expected BranchLocal, not %v", t)
|
||||||
}
|
}
|
||||||
b, bt, err = i.Next()
|
b, bt, err = i.Next()
|
||||||
if err != ErrIterOver {
|
if !IsErrorCode(err, ErrIterOver) {
|
||||||
t.Fatal("expected iterover")
|
t.Fatal("expected iterover")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue