git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Junio C Hamano <junio@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] diff --no-index -q: fix endless loop
Date: Wed,  7 Jan 2009 12:15:30 +0100	[thread overview]
Message-ID: <1231326930-7132-1-git-send-email-trast@student.ethz.ch> (raw)
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)

  reply	other threads:[~2009-01-07 11:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-06 23:56 [RFC PATCH] diff --no-index: test for pager after option parsing Thomas Rast
2009-01-07  0:09 ` Thomas Rast
2009-01-07  0:09 ` Junio C Hamano
2009-01-07  3:20   ` Miklos Vajna
2009-01-07  6:42     ` Jeff King
2009-01-07  7:02     ` Junio C Hamano
2009-01-07 11:15       ` Thomas Rast [this message]
2009-01-07 21:30         ` [PATCH] diff --no-index -q: fix endless loop Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1231326930-7132-1-git-send-email-trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=junio@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).