Skip to content

Commit

Permalink
diff-ni: allow running from a subdirectory.
Browse files Browse the repository at this point in the history
When run from a subdirectory of a repository, the command forgot
to adjust paths given to it with prefix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Mar 4, 2007
1 parent e551208 commit ae792aa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion diff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,19 @@ int setup_diff_no_index(struct rev_info *revs,
die("invalid diff option/value: %s", argv[i]);
i += j;
}
revs->diffopt.paths = argv + argc - 2;

if (prefix) {
int len = strlen(prefix);

revs->diffopt.paths = xcalloc(2, sizeof(char*));
for (i = 0; i < 2; i++) {
const char *p;
p = prefix_filename(prefix, len, argv[argc - 2 + i]);
revs->diffopt.paths[i] = xstrdup(p);
}
}
else
revs->diffopt.paths = argv + argc - 2;
revs->diffopt.nr_paths = 2;
revs->max_count = -2;
return 0;
Expand Down

0 comments on commit ae792aa

Please sign in to comment.