diff --git a/branch.go b/branch.go index a0c1dbd..af21140 100644 --- a/branch.go +++ b/branch.go @@ -53,9 +53,7 @@ func (i *BranchIterator) Next() (*Branch, BranchType, error) { ecode := C.git_branch_next(&refPtr, &refType, i.ptr) - if ecode == C.GIT_ITEROVER { - return nil, BranchLocal, ErrIterOver - } else if ecode < 0 { + if ecode < 0 { return nil, BranchLocal, MakeGitError(ecode) } diff --git a/branch_test.go b/branch_test.go index 2b168f5..44f6338 100644 --- a/branch_test.go +++ b/branch_test.go @@ -20,7 +20,7 @@ func TestBranchIterator(t *testing.T) { t.Fatalf("expected BranchLocal, not %v", t) } b, bt, err = i.Next() - if err != ErrIterOver { + if !IsErrorCode(err, ErrIterOver) { t.Fatal("expected iterover") } }