From: Nguyen Thai Ngoc Duy Date: Mon, 15 Oct 2012 04:09:26 GMT Subject: Re: [PATCH] exclude: fix a bug in prefix comparison optimization Message-ID: In-Reply-To: <7v8vb9yn09.fsf@alter.siamese.dyndns.org> On Mon, Oct 15, 2012 at 12:36 AM, Junio C Hamano wrote: > With your "teach attr.c match the same optimization as dir.c" > series, you would need something like this > > diff --git i/attr.c w/attr.c > index 6d39406..528e935 100644 > --- i/attr.c > +++ w/attr.c > @@ -710,7 +710,7 @@ static int path_matches(const char *pathname, int pathlen, > * if the non-wildcard part is longer than the remaining > * pathname, surely it cannot match. > */ > - if (!namelen || prefix > namelen) > + if (prefix > namelen) > return 0; > if (baselen != 0) > baselen++; If there's still a chance to rewrite attr-match-optim-more series (I see it's in next now), then I could reorder the patches so that excluded_from_list code refactoring goes first, then rewrite "teach attr.c match... as dir.c" patch makes use of the new functions without code duplication. The end result would be the same, except that we won't see this bug in attr.c's history. Not much value so if it may take a lot of your time, don't bother. -- Duy