diff options
author | Johannes Sixt <j6t@kdbg.org> | 2025-06-21 16:39:14 +0200 |
---|---|---|
committer | Johannes Sixt <j6t@kdbg.org> | 2025-06-21 16:39:14 +0200 |
commit | e8dd723956bee3809931ecc33b80d134a7f39889 (patch) | |
tree | 0e43c8920be12a453aecfe34ec33c77a25002c32 /lib/commit.tcl | |
parent | 2f0f286862fce80e3218facdf096bc6b20df2197 (diff) | |
parent | 80983c4131e2f35f6363d4d3580c39d6306236a4 (diff) |
Merge branch 'ob/strip-comments-on-commit'
* ob/strip-comments-on-commit:
git-gui: do not end the commit message with an empty line
Diffstat (limited to 'lib/commit.tcl')
-rw-r--r-- | lib/commit.tcl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/commit.tcl b/lib/commit.tcl index a570f9cdc6..0c2be6f619 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -214,12 +214,10 @@ You must stage at least 1 file before you can commit. global comment_string set cmt_rx [strcat {(^|\n)} [regsub -all {\W} $comment_string {\\&}] {[^\n]*}] regsub -all $cmt_rx $msg {\1} msg - # Strip leading empty lines - regsub {^\n*} $msg {} msg + # Strip leading and trailing empty lines (puts adds one \n) + set msg [string trim $msg \n] # 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. |