Skip to content

Commit

Permalink
Merge pull request #2175 from dscho/difftool-no-index
Browse files Browse the repository at this point in the history
Allow `git difftool --no-index` to run outside of a worktree
  • Loading branch information
dscho committed May 10, 2019
2 parents b4f650d + 15072c8 commit ba637d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions builtin/difftool.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,16 +723,16 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
if (!no_index && !startup_info->have_repository)
die(_("difftool requires worktree or --no-index"));

if (use_gui_tool + !!difftool_cmd + !!extcmd > 1)
die(_("--gui, --tool and --extcmd are mutually exclusive"));

if (!no_index){
setup_work_tree();
setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1);
setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1);
} else if (dir_diff)
die(_("--dir-diff is incompatible with --no-index"));

if (use_gui_tool + !!difftool_cmd + !!extcmd > 1)
die(_("--gui, --tool and --extcmd are mutually exclusive"));

if (use_gui_tool)
setenv("GIT_MERGETOOL_GUI", "true", 1);
else if (difftool_cmd) {
Expand Down

0 comments on commit ba637d3

Please sign in to comment.