mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-02-07 16:28:12 +02:00
Fixes #2691 This is changing the trimming of the merge message template to allow first empty line to be considered as empty message (also referred as title in frontend). 2 unit tests were added to check for proper behavior and possible edge case (simple template with only 2 lines, not trimming needed). Also a former unit test with 3 empty lines at the beginning of the template was changed. The behavior with this patch is: * splitting first `\n` to separate message from body * trim remaining `\n` from body if `\n` was present or take template as is as message (no trim necessary as no `\n` is present in the template) As this is an old issue the expected behavior might have changed from when the issue was triaged. I additionally manually testes on the next.forgejo.org and locally built binary from this branch, I am attaching both screenshot of final result. The test PR can be seen at [https://v13.next.forgejo.org/kajika/merge_template_issue_2691/pulls/1](https://v13.next.forgejo.org/kajika/merge_template_issue_2691/pulls/1) and, in case the next repository is deletate the content of `.forgejo/default_merge_message/MERGE_TEMPLATE.md` is (first line is empty): ``` This is the description of the merge from "${HeadBranch}" to "${BaseBranch}" ``` Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9930 Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Corentin <corentin@ayo.tokyo> Co-committed-by: Corentin <corentin@ayo.tokyo>