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

Commit

Permalink
Fix space-prefixed commit header line handling in decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
sttts committed Oct 4, 2018
1 parent d3cec13 commit 526add4
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 526add4

Please sign in to comment.