summaryrefslogtreecommitdiff
path: root/diff-no-index.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-06-27 11:51:15 -0700
committerJunio C Hamano <gitster@pobox.com>2012-06-28 16:09:40 -0700
commitc20f592611c2760a14d37fa1780afd2093159aeb (patch)
tree674a94b87f7c62b7f22c573b578fc9feca932d48 /diff-no-index.c
parentf174a2583c9f42315b60205890fa67a79a1f1669 (diff)
downloadgit-c20f592611c2760a14d37fa1780afd2093159aeb.tar.gz
diff-index.c: do not pretend paths are pathspecs
"git diff --no-index" takes exactly two paths, not pathspecs, and has its own way queue_diff() to populate the diff_queue. Do not call diff_tree_setup_paths(), pretending as it takes pathspecs. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-no-index.c')
-rw-r--r--diff-no-index.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/diff-no-index.c b/diff-no-index.c
index 3a36144687..31cc5b187e 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -173,6 +173,7 @@ void diff_no_index(struct rev_info *revs,
int i;
int no_index = 0;
unsigned options = 0;
+ const char *paths[2];
/* Were we asked to do --no-index explicitly? */
for (i = 1; i < argc; i++) {
@@ -231,8 +232,6 @@ void diff_no_index(struct rev_info *revs,
if (prefix) {
int len = strlen(prefix);
- const char *paths[3];
- memset(paths, 0, sizeof(paths));
for (i = 0; i < 2; i++) {
const char *p = argv[argc - 2 + i];
@@ -245,10 +244,10 @@ void diff_no_index(struct rev_info *revs,
: p);
paths[i] = p;
}
- diff_tree_setup_paths(paths, &revs->diffopt);
+ } else {
+ for (i = 0; i < 2; i++)
+ paths[i] = argv[argc - 2 + i];
}
- else
- diff_tree_setup_paths(argv + argc - 2, &revs->diffopt);
revs->diffopt.skip_stat_unmatch = 1;
if (!revs->diffopt.output_format)
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
@@ -260,8 +259,7 @@ void diff_no_index(struct rev_info *revs,
if (diff_setup_done(&revs->diffopt) < 0)
die("diff_setup_done failed");
- if (queue_diff(&revs->diffopt, revs->diffopt.pathspec.raw[0],
- revs->diffopt.pathspec.raw[1]))
+ if (queue_diff(&revs->diffopt, paths[0], paths[1]))
exit(1);
diff_set_mnemonic_prefix(&revs->diffopt, "1/", "2/");
diffcore_std(&revs->diffopt);