Skip to content

Commit 59e8f45

Browse files
committed
git gui: add directly calling merge tool from gitconfig
* git Gui can open a merge tool when conflicts are detected. The merge tools that are allowed to call have to be hard coded into git Gui althgough there are configuration options for merge tools git in the git config. Git calls the configured merge tools directly from the config while git Gui doesn't. * git Gui can now call the tool configured in the gitconfig directly. * Can be enabled through setting gui.mergeToolFromConfig * Disabled by default, since option is most likely never set * bc3 and vscode tested Signed-off-by: deboeto <tobias.boesch@miele.com>
1 parent b9849e4 commit 59e8f45

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Documentation/config/gui.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ gui.blamehistoryctx::
5555
linkgit:gitk[1] for the selected commit, when the `Show History
5656
Context` menu item is invoked from 'git gui blame'. If this
5757
variable is set to zero, the whole history is shown.
58+
59+
gui.mergeToolFromConfig::
60+
If true, allow to call the merge tool configured in gitconfig
61+
in git gui directly.

git-gui/lib/mergetool.tcl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,15 @@ proc merge_resolve_tool2 {} {
272272
}
273273
}
274274
default {
275-
error_popup [mc "Unsupported merge tool '%s'" $tool]
276-
return
275+
if {[is_config_true gui.mergetoolfromconfig]} {
276+
set path [get_config mergetool.$tool.path]
277+
set cmdline_config [get_config mergetool.$tool.cmd]
278+
set cmdline_substituted [subst -nobackslashes -nocommands $cmdline_config]
279+
set cmdline [lreplace $cmdline_substituted 0 0 $path]
280+
} else {
281+
error_popup [mc "Unsupported merge tool '%s'" $tool]
282+
return
283+
}
277284
}
278285
}
279286

0 commit comments

Comments
 (0)