]> git.ipfire.org Git - thirdparty/git.git/commit
git-gui: do not end the commit message with an empty line
authorJohannes Sixt <j6t@kdbg.org>
Wed, 14 May 2025 20:41:30 +0000 (22:41 +0200)
committerJohannes Sixt <j6t@kdbg.org>
Thu, 15 May 2025 17:44:45 +0000 (19:44 +0200)
commit80983c4131e2f35f6363d4d3580c39d6306236a4
tree10a75b8459b439eadc89b537f83b4c47080585fb
parent6b43a57dfce1e5acd85f7a8365c080b6fc4f8645
git-gui: do not end the commit message with an empty line

The commit message is processed to remove unnecessary empty lines.
In particular, it is ensured that the text ends with at most one LF
character. This one is always present, because the Tk text widget
ensures that is present.

However, did not consider that the processed text is written to the
commit message file using `puts`, which also appends a LF character,
so that the final commit message ends with two LF. Trim all trailing
LF characters, and while we are here, use `string trim`, which lets
us remove the leading LF in the same command.

Reported-by: Gareth Fenn <garethfenn@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
lib/commit.tcl