Skip to content

Commit

Permalink
Merge branch 'ob/strip-comments-on-commit'
Browse files Browse the repository at this point in the history
* ob/strip-comments-on-commit:
  git-gui: strip commit messages less aggressively
  git-gui: strip comments and consecutive empty lines from commit messages
  • Loading branch information
j6t committed Nov 9, 2024
2 parents 4925501 + 9093496 commit e503389
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/commit.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +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 e503389

Please sign in to comment.