File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -207,8 +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
213+ # Strip comment lines
214+ regsub -all {(^|\n)#[^\n]*} $msg {\1} msg
215+ # Strip leading empty lines
216+ regsub {^\n*} $msg {} msg
217+ # Compress consecutive empty lines
218+ regsub -all {\n{3,}} $msg "\n\n " msg
219+ # Strip trailing empty line
220+ regsub {\n\n$} $msg "\n " msg
212221 if {$msg eq {}} {
213222 error_popup [mc " Please supply a commit message.
214223
Original file line number Diff line number Diff line change @@ -272,8 +272,25 @@ proc merge_resolve_tool2 {} {
272272 }
273273 }
274274 default {
275- error_popup [mc " Unsupported merge tool '%s'" $tool ]
276- return
275+ set tool_cmd [get_config mergetool.$tool .cmd]
276+ if {$tool_cmd ne {}} {
277+ if {([string first {[} $tool_cmd ] != -1) || ([string first {]} $tool_cmd ] != -1)} {
278+ error_popup [mc " Unable to process square brackets in \" mergetool.%s.cmd\" configuration option.
279+
280+ Please remove the square brackets." $tool ]
281+ return
282+ } else {
283+ set cmdline {}
284+ foreach command_part $tool_cmd {
285+ lappend cmdline [subst -nobackslashes -nocommands $command_part ]
286+ }
287+ }
288+ } else {
289+ error_popup [mc " Unsupported merge tool '%s'.
290+
291+ To use this tool, configure \" mergetool.%s.cmd\" as shown in the git-config manual page." $tool $tool ]
292+ return
293+ }
277294 }
278295 }
279296
You can’t perform that action at this time.
0 commit comments