From a7d3c5955ac9426dd57bf4d3df87ca1eba049789 Mon Sep 17 00:00:00 2001 From: Jesse Ezell Date: Fri, 4 Apr 2014 00:56:58 -0700 Subject: [PATCH] merge with improved error handling logic --- branch.go | 4 +--- branch_test.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) 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") } }