From 298f2e2111905388e3d10cd0db0221a22dc7a62f Mon Sep 17 00:00:00 2001 From: Mirko Nosenzo Date: Sun, 29 May 2016 13:13:58 +0200 Subject: BranchAll maps GIT_BRANCH_ALL Added support to All Branch Iteration and Lookup --- branch.go | 1 + 1 file changed, 1 insertion(+) (limited to 'branch.go') diff --git a/branch.go b/branch.go index df72dba..a869054 100644 --- a/branch.go +++ b/branch.go @@ -13,6 +13,7 @@ import ( type BranchType uint const ( + BranchAll BranchType = C.GIT_BRANCH_ALL BranchLocal BranchType = C.GIT_BRANCH_LOCAL BranchRemote BranchType = C.GIT_BRANCH_REMOTE ) -- cgit v1.2.3 From 74bc3c6242f8696553aa2529767219ede1ff47ad Mon Sep 17 00:00:00 2001 From: Michael Daffin Date: Mon, 5 Sep 2016 15:56:09 +0100 Subject: Add check for ErrIterOver in BranchIterator.ForEach The BranchIterator.ForEach currently returns the ErrIterOver error if no error had occured during the iteration. This leads to a rather unhelpful blank error message with the error code -31 when iterating over the branches. This commit adds a check for ErrIterOver at the end of the ForEach method so that the client code only has to worry about checking for nil as apose to checking for the ErrIterOver error. --- branch.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'branch.go') diff --git a/branch.go b/branch.go index a869054..d381c23 100644 --- a/branch.go +++ b/branch.go @@ -73,6 +73,10 @@ func (i *BranchIterator) ForEach(f BranchIteratorFunc) error { } } + if err != nil && IsErrorCode(err, ErrIterOver) { + return nil + } + return err } -- cgit v1.2.3