Skip to content

Commit 70b9154

Browse files
Allow parsing of commit messages up to 10MB
1 parent 8b92ea0 commit 70b9154

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (c *Commit) Decode(hash hash.Hash, from io.Reader, size int64) (n int, err
9797
var messageParts []string
9898

9999
s := bufio.NewScanner(from)
100-
s.Buffer(nil, 1024*1024)
100+
s.Buffer(nil, 10*1024*1024)
101101
for s.Scan() {
102102
text := s.Text()
103103
n = n + len(text+"\n")

commit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ func TestCommitDecodingWithEmptyName(t *testing.T) {
120120

121121
func TestCommitDecodingWithLargeCommitMessage(t *testing.T) {
122122
message := "This message text is, with newline, exactly 64 characters long. "
123-
// This message will be exactly 1 MiB in size when part of the commit.
124-
longMessage := strings.Repeat(message, (1024*1024/64)-1)
123+
// This message will be exactly 10 MiB in size when part of the commit.
124+
longMessage := strings.Repeat(message, (10*1024*1024/64)-1)
125125
longMessage += strings.TrimSpace(message)
126126

127127
author := &Signature{Name: "", Email: "john@example.com", When: time.Now()}

0 commit comments

Comments
 (0)