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

@ -23,7 +23,10 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
git_config(git_default_config); /* no "diff" UI options */
rev.abbrev = 0;
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_RAW;
return run_diff_files_cmd(&rev, argc, argv);