From: Jeff King <peff@peff.net>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] diffcore-pickaxe: fix infinite loop on zero-length needle
Date: Thu, 25 Jan 2007 23:56:40 -0500 [thread overview]
Message-ID: <20070126045639.GA9260@coredump.intra.peff.net> (raw)
In-Reply-To: <20070126044858.GA8653@coredump.intra.peff.net>
On Thu, Jan 25, 2007 at 11:48:58PM -0500, Jeff King wrote:
> has zero length. The loop could be modified to handle this, but it makes
> more sense to simply have an empty needle return no matches. Thus, a
> command like
> git log -S
> produces no output.
>
> We place the check at the top of the function so that we get the same
> results with or without --pickaxe-regex. Note that until now,
> git log -S --pickaxe-regex
> would match everything, not nothing.
My assumption is that nobody is really depending on this behavior
(since, after all, without --pickaxe-regex it caused an infinite loop!).
If you want to maintain consistency, the conditional should simply
return 1 instead of 0 (no callers of contains() actually care about the
count value).
-Peff
next prev parent reply other threads:[~2007-01-26 4:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-26 4:48 [PATCH] diffcore-pickaxe: fix infinite loop on zero-length needle Jeff King
2007-01-26 4:56 ` Jeff King [this message]
2007-01-26 5:16 ` 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=20070126045639.GA9260@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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