Merge branch 'tk/mergetool-gui-default-config'
"git mergetool" and "git difftool" learns a new configuration guiDefault to optionally favor configured guitool over non-gui-tool automatically when $DISPLAY is set. * tk/mergetool-gui-default-config: mergetool: new config guiDefault supports auto-toggling gui by DISPLAY
This commit is contained in:
@ -691,7 +691,7 @@ static int run_file_diff(int prompt, const char *prefix,
|
||||
|
||||
int cmd_difftool(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
int use_gui_tool = 0, dir_diff = 0, prompt = -1, symlinks = 0,
|
||||
int use_gui_tool = -1, dir_diff = 0, prompt = -1, symlinks = 0,
|
||||
tool_help = 0, no_index = 0;
|
||||
static char *difftool_cmd = NULL, *extcmd = NULL;
|
||||
struct option builtin_difftool_options[] = {
|
||||
@ -741,13 +741,21 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
|
||||
} else if (dir_diff)
|
||||
die(_("options '%s' and '%s' cannot be used together"), "--dir-diff", "--no-index");
|
||||
|
||||
die_for_incompatible_opt3(use_gui_tool, "--gui",
|
||||
die_for_incompatible_opt3(use_gui_tool == 1, "--gui",
|
||||
!!difftool_cmd, "--tool",
|
||||
!!extcmd, "--extcmd");
|
||||
|
||||
if (use_gui_tool)
|
||||
/*
|
||||
* Explicitly specified GUI option is forwarded to git-mergetool--lib.sh;
|
||||
* empty or unset means "use the difftool.guiDefault config or default to
|
||||
* false".
|
||||
*/
|
||||
if (use_gui_tool == 1)
|
||||
setenv("GIT_MERGETOOL_GUI", "true", 1);
|
||||
else if (difftool_cmd) {
|
||||
else if (use_gui_tool == 0)
|
||||
setenv("GIT_MERGETOOL_GUI", "false", 1);
|
||||
|
||||
if (difftool_cmd) {
|
||||
if (*difftool_cmd)
|
||||
setenv("GIT_DIFF_TOOL", difftool_cmd, 1);
|
||||
else
|
||||
|
Reference in New Issue
Block a user