Unexpected newline in commit messages with signed-off metadata
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
When using (at least) a Signed-off-by
marking in a commit message, GitLab's commit view will present a commit message with leading empty newlines.
Steps to reproduce
Create a commit with the following example content and push into a branch:
my subject
This is my content.
Signed-off-by: My Example <my@example.com>
Then view the commit on GitLab and observe that an extract newline is render.
Example Project
The commit https://gitlab.com/jdknight/git-commit-formatting/-/commit/aa7092ffb17d612067614a3ba71b69bc5ee05707 without a sign-off marking with a nicely formatted message, where the commit https://gitlab.com/jdknight/git-commit-formatting/-/commit/671b0c5fb0d198441ccfd48bbcb45f1fc2950419 with a sign-off marking includes an undesired newline at the start.
What is the current bug behavior?
Empty leading newlines exists in the rendered commit message.
What is the expected correct behavior?
Empty leading newlines should be removed in the rendered commit message.
Relevant logs and/or screenshots
The follow rendering shows an unexpected newline spacing:
Output of checks
This bug happens on GitLab.com.
Results of GitLab environment info
n/a
Results of GitLab application Check
n/a
Possible fixes
It appears in this scenario that the content is not removing empty lines the start:
The rendering logic should be stripping empty newlines at the start of a message (after the title extraction; important to not left strip the entire message if there is indented content to render).