summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a567fdc)
raw | patch | inline | side by side (parent: a567fdc)
author | Thomas Rast <trast@student.ethz.ch> | |
Tue, 6 Jan 2009 18:53:32 +0000 (19:53 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 7 Jan 2009 07:18:20 +0000 (23:18 -0800) |
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>
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>
diff-no-index.c | patch | blob | history | |
t/t4013-diff-various.sh | patch | blob | history | |
t/t4013/diff.diff_--no-index_--name-status_--_dir2_dir | [new file with mode: 0644] | patch | blob |
diff --git a/diff-no-index.c b/diff-no-index.c
index b60d3455dae14a7a2cf2daeec8eb47fc7dcd9a09..39868e2a8fa47e91f8d21814ac433b516fc9535c 100644 (file)
--- a/diff-no-index.c
+++ b/diff-no-index.c
/* 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] != '-')
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)
index aeb5405cfeee83f13f3d543db2eba07f1fb5c241..aba53202f84b6c6c16a68f45ccfa42368e47d421 100755 (executable)
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
diff --patch-with-raw -r initial..side
diff --name-status dir2 dir
diff --no-index --name-status dir2 dir
+diff --no-index --name-status -- dir2 dir
diff master master^ side
EOF
diff --git a/t/t4013/diff.diff_--no-index_--name-status_--_dir2_dir b/t/t4013/diff.diff_--no-index_--name-status_--_dir2_dir
--- /dev/null
@@ -0,0 +1,3 @@
+$ git diff --no-index --name-status -- dir2 dir
+A dir/sub
+$