Skip to content

Commit

Permalink
git-gui: strip commit messages less aggressively
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ossilator authored and j6t committed Aug 15, 2024
1 parent 1ae85ff commit 9093496
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/commit.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9093496

Please sign in to comment.