Skip to content

Commit fb91a85

Browse files
committed
Fix duplicated opened batch cat file
1 parent aaec98d commit fb91a85

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

modules/git/repo_commit_nogogit.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package git
77

88
import (
9-
"bufio"
109
"errors"
1110
"io"
1211
"strings"
@@ -82,10 +81,11 @@ func (repo *Repository) getCommit(id ObjectID) (*Commit, error) {
8281
return nil, err
8382
}
8483

85-
return repo.getCommitFromBatchReader(batch.Reader(), id)
84+
return repo.getCommitFromBatchReader(batch, id)
8685
}
8786

88-
func (repo *Repository) getCommitFromBatchReader(rd *bufio.Reader, id ObjectID) (*Commit, error) {
87+
func (repo *Repository) getCommitFromBatchReader(batch *BatchCatFile, id ObjectID) (*Commit, error) {
88+
rd := batch.Reader()
8989
_, typ, size, err := ReadBatchLine(rd)
9090
if err != nil {
9191
if errors.Is(err, io.EOF) || IsErrNotExist(err) {
@@ -113,7 +113,11 @@ func (repo *Repository) getCommitFromBatchReader(rd *bufio.Reader, id ObjectID)
113113
return nil, err
114114
}
115115

116-
commit, err := tag.Commit(repo)
116+
if err = batch.Input(tag.Object.String()); err != nil {
117+
return nil, err
118+
}
119+
120+
commit, err := repo.getCommitFromBatchReader(batch, tag.Object)
117121
if err != nil {
118122
return nil, err
119123
}

0 commit comments

Comments
 (0)