diff options
author | Oswald Buddenhagen <oswald.buddenhagen@gmx.de> | 2024-08-13 11:06:31 +0200 |
---|---|---|
committer | Johannes Sixt <j6t@kdbg.org> | 2024-08-15 16:10:23 +0200 |
commit | 90934966bbac07d8d480b5257ba50945f0ec45c8 (patch) | |
tree | 0f5ca19fdb26fa31154e6b3c1dc8b2b5c21e3992 /lib/commit.tcl | |
parent | 1ae85ff6d418238b8d987c9e019bd785e3ae7192 (diff) |
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>
Diffstat (limited to 'lib/commit.tcl')
-rw-r--r-- | lib/commit.tcl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/commit.tcl b/lib/commit.tcl index f00a634624..208dc2817c 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -207,12 +207,17 @@ You must stage at least 1 file before you can commit. # -- A message is required. # - set msg [string trim [$ui_comm get 1.0 end]] + set msg [$ui_comm get 1.0 end] + # Strip trailing whitespace regsub -all -line {[ \t\r]+$} $msg {} msg # Strip comment lines regsub -all {(^|\n)#[^\n]*} $msg {\1} msg + # Strip leading empty lines + regsub {^\n*} $msg {} msg # Compress consecutive empty lines regsub -all {\n{3,}} $msg "\n\n" msg + # Strip trailing empty line + regsub {\n\n$} $msg "\n" msg if {$msg eq {}} { error_popup [mc "Please supply a commit message. |