Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit d7c00b0

Browse files
committed
Handle io.EOF error in commitFileIter.ForEach
Signed-off-by: knqyf263 <knqyf263@gmail.com>
1 parent 0373247 commit d7c00b0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎plumbing/object/commit_walker_file.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ func isParentHash(hash plumbing.Hash, commit *Commit) bool {
128128
func (c *commitFileIter) ForEach(cb func(*Commit) error) error {
129129
for {
130130
commit, nextErr := c.Next()
131-
if nextErr != nil {
131+
if nextErr == io.EOF {
132+
break
133+
} else if nextErr != nil {
132134
return nextErr
133135
}
134136
err := cb(commit)
@@ -138,6 +140,7 @@ func (c *commitFileIter) ForEach(cb func(*Commit) error) error {
138140
return err
139141
}
140142
}
143+
return nil
141144
}
142145

143146
func (c *commitFileIter) Close() {

‎repository_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"testing"
1414
"time"
1515

16-
fixtures "gopkg.in/src-d/go-git-fixtures.v3"
1716

1817
"golang.org/x/crypto/openpgp"
1918
"golang.org/x/crypto/openpgp/armor"
@@ -33,6 +32,7 @@ import (
3332
"gopkg.in/src-d/go-billy.v4/memfs"
3433
"gopkg.in/src-d/go-billy.v4/osfs"
3534
"gopkg.in/src-d/go-billy.v4/util"
35+
"gopkg.in/src-d/go-git-fixtures.v3"
3636
)
3737

3838
type RepositorySuite struct {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /