Re: [PATCH] exclude: fix a bug in prefix comparison optimization
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:01
Nguyen Thai Ngoc Duy [off-list ref] writes:
On Mon, Oct 15, 2012 at 12:36 AM, Junio C Hamano [off-list ref] wrote:quoted
With your "teach attr.c match the same optimization as dir.c" series, you would need something like thisdiff --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.
Actually it started to become nuisance to deal with conflicts among as/check-ignore and the attr/dir/wildmatch series, and I've been wondering if it makes sense to eject all of these out of 'next' (as they won't advance beyond 'next' until the next release anyway). So please go ahead and reroll the whole thing if you think the end result would be a history with better organization.