Skip to content

Commit 6470f91

Browse files
authored
Fix decoding panic caused by wrong commit
eg: ``` tree 2aedfd35087c75d17bdbaf4dd56069d44fc75b71 parent 75158117eb8efe60453f8c077527ac3530c81e38 author Credit Card Account <Credit Card Account> 1722305889 +0800 committer \346\244\260\346\235\215 <Credit Card Account> 1722305889 +0800 Credit Card Account ```
1 parent b805ee7 commit 6470f91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

commit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (c *Commit) Decode(hash hash.Hash, from io.Reader, size int64) (n int, err
145145
c.Committer = ""
146146
}
147147
default:
148-
if strings.HasPrefix(s.Text(), " ") {
148+
if strings.HasPrefix(text, " ") && len(c.ExtraHeaders) > 0 {
149149
idx := len(c.ExtraHeaders) - 1
150150
hdr := c.ExtraHeaders[idx]
151151

0 commit comments

Comments
 (0)