Skip to content

Commit e8dd723

Browse files
committed
Merge branch 'ob/strip-comments-on-commit'
* ob/strip-comments-on-commit: git-gui: do not end the commit message with an empty line
2 parents 2f0f286 + 80983c4 commit e8dd723

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/commit.tcl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,10 @@ You must stage at least 1 file before you can commit.
214214
global comment_string
215215
set cmt_rx [strcat {(^|\n)} [regsub -all {\W} $comment_string {\\&}] {[^\n]*}]
216216
regsub -all $cmt_rx $msg {\1} msg
217-
# Strip leading empty lines
218-
regsub {^\n*} $msg {} msg
217+
# Strip leading and trailing empty lines (puts adds one \n)
218+
set msg [string trim $msg \n]
219219
# Compress consecutive empty lines
220220
regsub -all {\n{3,}} $msg "\n\n" msg
221-
# Strip trailing empty line
222-
regsub {\n\n$} $msg "\n" msg
223221
if {$msg eq {}} {
224222
error_popup [mc "Please supply a commit message.
225223

0 commit comments

Comments
 (0)