Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 526add4

Browse files
committed
Fix space-prefixed commit header line handling in decoding
1 parent d3cec13 commit 526add4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plumbing/object/commit.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,17 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) {
192192
}
193193

194194
if !message {
195-
line = bytes.TrimSpace(line)
195+
line = bytes.TrimSuffix(line, []byte{'\n'})
196196
if len(line) == 0 {
197197
message = true
198198
continue
199199
}
200200

201+
if line[0] == byte(' ') {
202+
continue
203+
}
204+
205+
line = bytes.TrimSpace(line)
201206
split := bytes.SplitN(line, []byte{' '}, 2)
202207

203208
var data []byte

0 commit comments

Comments
 (0)