[PATCH] diff --no-index -q: fix endless loop
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Jan 7, 2009, 11:15 UTC
- Message-ID
- <1231326930-7132-1-git-send-email-trast@student.ethz.ch>
- In-Reply-To
- <7veizfbnuw.fsf@gitster.siamese.dyndns.org>
We forgot to move to the next argument when parsing -q, getting stuck in an endless loop.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Junio C Hamano wrote:
> I'll queue the "--" fix, "-q" fix and this pager fix. Thanks.
Seems the after-midnight rule indeed has some value. I pointed out the argv[i] bug, which I see you have squashed into the -- fix, but failed to notice that the -q parsing is also missing an i++.
I'm still not convinced of the option's value, but this patch at least fixes the bug.
diff-no-index.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/diff-no-index.c b/diff-no-index.c index 12ff1f1..60ed174 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -207,8 +207,10 @@ void diff_no_index(struct rev_info *revs, int j; if (!strcmp(argv[i], "--no-index")) i++; - else if (!strcmp(argv[i], "-q")) + else if (!strcmp(argv[i], "-q")) { options |= DIFF_SILENT_ON_REMOVED; + i++; + } else if (!strcmp(argv[i], "--")) i++; else {
-- tg: (3bbe36c..) t/diff-q-endless (depends on: next)