git-gui: strip commit messages less aggressively

We would strip all leading and trailing whitespace, which git commit does not. Let's be consistent here. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org>

Oswald Buddenhagen committed Aug 13, 2024 at 11:06 UTC 90934966bbac07d8d480b5257ba50945f0ec45c8
1 file changed +6 -1
lib/commit.tcl
+6 -1
@@ -207,12 +207,17 @@ You must stage at least 1 file before you can commit.
207
208 # -- A message is required.
209 #
210 - set msg [string trim [$ui_comm get 1.0 end]]
210 + set msg [$ui_comm get 1.0 end]
211 + # Strip trailing whitespace
212 regsub -all -line {[ \t\r]+$} $msg {} msg
213 # Strip comment lines
214 regsub -all {(^|\n)#[^\n]*} $msg {\1} msg
215 + # Strip leading empty lines
216 + regsub {^\n*} $msg {} msg
217 # Compress consecutive empty lines
218 regsub -all {\n{3,}} $msg "\n\n" msg
219 + # Strip trailing empty line
220 + regsub {\n\n$} $msg "\n" msg
221 if {$msg eq {}} {
222 error_popup [mc "Please supply a commit message.
223