Re: [PATCH] exclude: fix a bug in prefix comparison optimization
From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:55:01
On Mon, Oct 15, 2012 at 12:36 AM, Junio C Hamano [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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. -- Duy