Merge branch 'nd/diff-with-path-params'

A few options of "git diff" did not work well when the command was
run from a subdirectory.

* nd/diff-with-path-params:
  diff: make -O and --output work in subdirectory
  diff-no-index: do not take a redundant prefix argument
This commit is contained in:
Junio C Hamano
2016-02-03 14:16:04 -08:00
7 changed files with 25 additions and 12 deletions

View File

@ -237,12 +237,12 @@ static void fixup_paths(const char **path, struct strbuf *replacement)
}
void diff_no_index(struct rev_info *revs,
int argc, const char **argv,
const char *prefix)
int argc, const char **argv)
{
int i, prefixlen;
const char *paths[2];
struct strbuf replacement = STRBUF_INIT;
const char *prefix = revs->prefix;
diff_setup(&revs->diffopt);
for (i = 1; i < argc - 2; ) {
@ -252,7 +252,8 @@ void diff_no_index(struct rev_info *revs,
else if (!strcmp(argv[i], "--"))
i++;
else {
j = diff_opt_parse(&revs->diffopt, argv + i, argc - i);
j = diff_opt_parse(&revs->diffopt, argv + i, argc - i,
revs->prefix);
if (j <= 0)
die("invalid diff option/value: %s", argv[i]);
i += j;