aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorknqyf263 <knqyf263@gmail.com>2019-08-03 16:02:48 -1000
committerknqyf263 <knqyf263@gmail.com>2019-08-03 17:08:34 -1000
commitd7c00b034ff5ce038c168ab16a943cc5f55aac3c (patch)
treefa915c534bd90a5e3886f948c6b9755ae244c15b
parent0373247790c1dd490f6756697c9d89bed9f7c4bb (diff)
downloadgo-git-d7c00b034ff5ce038c168ab16a943cc5f55aac3c.tar.gz
Handle io.EOF error in commitFileIter.ForEach
Signed-off-by: knqyf263 <knqyf263@gmail.com>
-rw-r--r--plumbing/object/commit_walker_file.go5
-rw-r--r--repository_test.go2
2 files changed, 5 insertions, 2 deletions
diff --git a/plumbing/object/commit_walker_file.go b/plumbing/object/commit_walker_file.go
index 6f16e61..76c158b 100644
--- a/plumbing/object/commit_walker_file.go
+++ b/plumbing/object/commit_walker_file.go
@@ -128,7 +128,9 @@ func isParentHash(hash plumbing.Hash, commit *Commit) bool {
func (c *commitFileIter) ForEach(cb func(*Commit) error) error {
for {
commit, nextErr := c.Next()
- if nextErr != nil {
+ if nextErr == io.EOF {
+ break
+ } else if nextErr != nil {
return nextErr
}
err := cb(commit)
@@ -138,6 +140,7 @@ func (c *commitFileIter) ForEach(cb func(*Commit) error) error {
return err
}
}
+ return nil
}
func (c *commitFileIter) Close() {
diff --git a/repository_test.go b/repository_test.go
index d7450c4..0e46ded 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -13,7 +13,6 @@ import (
"testing"
"time"
- fixtures "gopkg.in/src-d/go-git-fixtures.v3"
"golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor"
@@ -33,6 +32,7 @@ import (
"gopkg.in/src-d/go-billy.v4/memfs"
"gopkg.in/src-d/go-billy.v4/osfs"
"gopkg.in/src-d/go-billy.v4/util"
+ "gopkg.in/src-d/go-git-fixtures.v3"
)
type RepositorySuite struct {