Skip to content

Commit

Permalink
git Gui: Add directly calling merge tool from gitconfig
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ToBoMi committed Aug 15, 2024
1 parent 477ce5c commit 7119d6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Documentation/config/gui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ gui.blamehistoryctx::
linkgit:gitk[1] for the selected commit, when the `Show History
Context` menu item is invoked from 'git gui blame'. If this
variable is set to zero, the whole history is shown.

gui.mergeToolFromConfig::
If true, allow to call the merge tool configured in gitconfig
in git gui directly.
11 changes: 9 additions & 2 deletions git-gui/lib/mergetool.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,15 @@ proc merge_resolve_tool2 {} {
}
}
default {
error_popup [mc "Unsupported merge tool '%s'" $tool]
return
if {[is_config_true gui.mergetoolfromconfig]} {
set path [get_config mergetool.$tool.path]
set cmdline_config [get_config mergetool.$tool.cmd]
set cmdline_substituted [subst -nobackslashes -nocommands $cmdline_config]
set cmdline [lreplace $cmdline_substituted 0 0 $path]
} else {
error_popup [mc "Unsupported merge tool '%s'" $tool]
return
}
}
}

Expand Down

0 comments on commit 7119d6d

Please sign in to comment.