From 982ac87316a1cf5126888157bdcbfa32268ebe47 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 28 Mar 2013 17:47:47 -0400 Subject: [PATCH] dir.c::match_pathname(): adjust patternlen when shifting pattern If we receive a pattern that starts with "/", we shift it forward to avoid looking at the "/" part. Since the prefix and patternlen parameters are counts of what is in the pattern, we must decrement them as we increment the pointer. We remembered to handle prefix, but not patternlen. This didn't cause any bugs, though, because the patternlen parameter is not actually used. Since it will be used in future patches, let's correct this oversight. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dir.c b/dir.c index 0db79f9cf..1757a3f4e 100644 --- a/dir.c +++ b/dir.c @@ -597,6 +597,7 @@ int match_pathname(const char *pathname, int pathlen, */ if (*pattern == '/') { pattern++; + patternlen--; prefix--; } -- 2.11.0