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

Fix space-prefixed commit header line handling in decoding #976

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion plumbing/object/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,17 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) {
}

if !message {
line = bytes.TrimSpace(line)
line = bytes.TrimSuffix(line, []byte{'\n'})
if len(line) == 0 {
message = true
continue
}

if line[0] == byte(' ') {
continue
}

line = bytes.TrimSpace(line)
split := bytes.SplitN(line, []byte{' '}, 2)

var data []byte
Expand Down