Unexpected newline in commit messages with signed-off metadata
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=537876) </details> <!--IssueSummary end--> ### 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: ![image](/uploads/19b899540bd781d72ac2972027303adc/image.png){width=620 height=453} ### 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: ![image](/uploads/f43ddb79a4421e903821731e9c91d7de/image.png){width=445 height=147} 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).
issue