diff options
author | Denton Liu <liu.denton@gmail.com> | 2019-04-29 08:21:17 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-13 16:11:59 +0200 |
commit | 7f978d7d10a87c4a56ea3101b936cddb25bbe2c6 (patch) | |
tree | a974ee6fc7fc745081d5a2e90e570fc0247b295f /builtin/difftool.c | |
parent | mergetool: fallback to tool when guitool unavailable (diff) | |
download | git-7f978d7d10a87c4a56ea3101b936cddb25bbe2c6.tar.xz git-7f978d7d10a87c4a56ea3101b936cddb25bbe2c6.zip |
difftool: make --gui, --tool and --extcmd mutually exclusive
In git-difftool, these options specify which tool to ultimately run. As
a result, they are logically conflicting. Explicitly disallow these
options from being used together.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/difftool.c')
-rw-r--r-- | builtin/difftool.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/difftool.c b/builtin/difftool.c index 544b0e8639..481aa64af5 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -730,6 +730,9 @@ int cmd_difftool(int argc, const char **argv, const char *prefix) setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1); setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1); + if (use_gui_tool + !!difftool_cmd + !!extcmd > 1) + die(_("--gui, --tool and --extcmd are mutually exclusive")); + if (use_gui_tool && diff_gui_tool && *diff_gui_tool) setenv("GIT_DIFF_TOOL", diff_gui_tool, 1); else if (difftool_cmd) { |