Re: [PATCH] diffcore-pickaxe: fix infinite loop on zero-length needle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]