diff: make more cases implicit --no-index

When specifying an absolute path, or a relative path pointing outside
the working tree, do not fail, but roll your own diffopt parsing,
and execute a --no-index diff.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Johannes Schindelin
2007-02-25 23:35:27 +01:00
committed by Junio C Hamano
parent 2eb06531e3
commit fcfa33ec90
4 changed files with 64 additions and 2 deletions

View File

@ -215,7 +215,10 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
git_config(git_diff_ui_config);
init_revisions(&rev, prefix);
argc = setup_revisions(argc, argv, &rev, NULL);
if (!setup_diff_no_index(&rev, argc, argv, nongit, prefix))
argc = 0;
else
argc = setup_revisions(argc, argv, &rev, NULL);
if (!rev.diffopt.output_format) {
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
if (diff_setup_done(&rev.diffopt) < 0)