aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-12-17 20:42:33 +0000
committerGitHub <noreply@github.com>2020-12-17 21:42:33 +0100
commite4567d428575405eda834bb49330e2e8b300642b (patch)
tree8a2df4294e147eba94b985aa4a49b476210197f5 /modules
parent3260e156682ea69fcf1f7441abd8d2483aab1d32 (diff)
downloadgitea-e4567d428575405eda834bb49330e2e8b300642b.tar.gz
gitea-e4567d428575405eda834bb49330e2e8b300642b.zip
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 <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/git/commit_reader.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/git/commit_reader.go b/modules/git/commit_reader.go
index 4eb861040e..a4d15b6bad 100644
--- a/modules/git/commit_reader.go
+++ b/modules/git/commit_reader.go
@@ -36,6 +36,10 @@ readLoop:
line, err := bufReader.ReadBytes('\n')
if err != nil {
if err == io.EOF {
+ if message {
+ _, _ = messageSB.Write(line)
+ }
+ _, _ = payloadSB.Write(line)
break readLoop
}
return nil, err
@@ -86,10 +90,10 @@ readLoop:
}
} else {
_, _ = messageSB.Write(line)
+ _, _ = payloadSB.Write(line)
}
}
commit.CommitMessage = messageSB.String()
- _, _ = payloadSB.WriteString(commit.CommitMessage)
commit.Signature = &CommitGPGSignature{
Signature: signatureSB.String(),
Payload: payloadSB.String(),