Skip to content

Commit 9093496

Browse files
ossilatorj6t
authored andcommitted
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 <[email protected]> Signed-off-by: Johannes Sixt <[email protected]>
1 parent 1ae85ff commit 9093496

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/commit.tcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,17 @@ You must stage at least 1 file before you can commit.
207207

208208
# -- A message is required.
209209
#
210-
set msg [string trim [$ui_comm get 1.0 end]]
210+
set msg [$ui_comm get 1.0 end]
211+
# Strip trailing whitespace
211212
regsub -all -line {[ \t\r]+$} $msg {} msg
212213
# Strip comment lines
213214
regsub -all {(^|\n)#[^\n]*} $msg {\1} msg
215+
# Strip leading empty lines
216+
regsub {^\n*} $msg {} msg
214217
# Compress consecutive empty lines
215218
regsub -all {\n{3,}} $msg "\n\n" msg
219+
# Strip trailing empty line
220+
regsub {\n\n$} $msg "\n" msg
216221
if {$msg eq {}} {
217222
error_popup [mc "Please supply a commit message.
218223

0 commit comments

Comments
 (0)