summaryrefslogtreecommitdiff
path: root/diff-no-index.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2009-01-06 19:53:32 +0100
committerJunio C Hamano <gitster@pobox.com>2009-01-06 23:18:20 -0800
commite423ffd8a6f46a14ecbb637d909290bd3579cebd (patch)
treedcb6814de273d92e9577b1ee6e459657b468e7b0 /diff-no-index.c
parenta567fdcb016e8e882ec0a1e044c9caac8f70e693 (diff)
downloadgit-e423ffd8a6f46a14ecbb637d909290bd3579cebd.tar.gz
diff: accept -- when using --no-index
Accept -- as an "end of options" marker even when using --no-index. Previously, the -- triggered a "normal" index/tree diff and subsequently failed because of the unrecognized (in that mode) --no-index. Note that the second loop can treat '--' as a normal option, because the preceding checks ensure it is the third-to-last argument. While at it, fix the parsing of "-q" option in --no-index mode as well. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-no-index.c')
-rw-r--r--diff-no-index.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/diff-no-index.c b/diff-no-index.c
index b60d3455da..39868e2a8f 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -173,8 +173,10 @@ void diff_no_index(struct rev_info *revs,
/* Were we asked to do --no-index explicitly? */
for (i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "--"))
- return;
+ if (!strcmp(argv[i], "--")) {
+ i++;
+ break;
+ }
if (!strcmp(argv[i], "--no-index"))
no_index = 1;
if (argv[i][0] != '-')
@@ -212,8 +214,10 @@ void diff_no_index(struct rev_info *revs,
int j;
if (!strcmp(argv[i], "--no-index"))
i++;
- else if (!strcmp(argv[1], "-q"))
+ else if (!strcmp(argv[i], "-q"))
options |= DIFF_SILENT_ON_REMOVED;
+ else if (!strcmp(argv[i], "--"))
+ i++;
else {
j = diff_opt_parse(&revs->diffopt, argv + i, argc - i);
if (!j)