Skip to content

Commit e4567d4

Browse files
authored
Fix bug in commit verification introduced in #13673 (#14040)
There is a slight bug in the commit_reader introduced in #13673 whereby commit messages which have a final unterminated line miss their final line. This PR fixes this. Signed-off-by: Andrew Thornton <[email protected]>
1 parent 3260e15 commit e4567d4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/git/commit_reader.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ readLoop:
3636
line, err := bufReader.ReadBytes('\n')
3737
if err != nil {
3838
if err == io.EOF {
39+
if message {
40+
_, _ = messageSB.Write(line)
41+
}
42+
_, _ = payloadSB.Write(line)
3943
break readLoop
4044
}
4145
return nil, err
@@ -86,10 +90,10 @@ readLoop:
8690
}
8791
} else {
8892
_, _ = messageSB.Write(line)
93+
_, _ = payloadSB.Write(line)
8994
}
9095
}
9196
commit.CommitMessage = messageSB.String()
92-
_, _ = payloadSB.WriteString(commit.CommitMessage)
9397
commit.Signature = &CommitGPGSignature{
9498
Signature: signatureSB.String(),
9599
Payload: payloadSB.String(),

0 commit comments

Comments
 (0)