diff options
author | Oswald Buddenhagen <oswald.buddenhagen@gmx.de> | 2025-03-15 15:09:13 +0100 |
---|---|---|
committer | Johannes Sixt <j6t@kdbg.org> | 2025-03-16 13:51:55 +0100 |
commit | 6b43a57dfce1e5acd85f7a8365c080b6fc4f8645 (patch) | |
tree | b0098d7a7a21b771b530e65e2364a823c907d6e6 /lib/commit.tcl | |
parent | 90934966bbac07d8d480b5257ba50945f0ec45c8 (diff) |
git-gui: heed core.commentChar/commentString
This amends 1ae85ff6d (git-gui: strip comments and consecutive empty
lines from commit messages, 2024-08-13) to deal with custom comment
characters/strings.
The magic commentString value "auto" is not handled, because the option
makes no sense to me - it does not support comments in templates and
hook output, and it seems far-fetched that someone would introduce
comments during editing the message.
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to 'lib/commit.tcl')
-rw-r--r-- | lib/commit.tcl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/commit.tcl b/lib/commit.tcl index 208dc2817c..a570f9cdc6 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -211,7 +211,9 @@ You must stage at least 1 file before you can commit. # Strip trailing whitespace regsub -all -line {[ \t\r]+$} $msg {} msg # Strip comment lines - regsub -all {(^|\n)#[^\n]*} $msg {\1} msg + 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 # Compress consecutive empty lines |