From: Duy Nguyen Date: Wed, 27 Mar 2013 01:30:22 GMT Subject: Re: [PATCH 3/4] attr.c::path_matches(): special case paths that end with a slash Message-ID: In-Reply-To: <20130326213319.GA3058@sigill.intra.peff.net> On Wed, Mar 27, 2013 at 4:33 AM, Jeff King wrote: > Hmm. match_pathname does have this: > > /* > * baselen does not count the trailing slash. base[] may or > * may not end with a trailing slash though. > */ > if (pathlen < baselen + 1 || > (baselen && pathname[baselen] != '/') || > strncmp_icase(pathname, base, baselen)) > return 0; > > which seems to imply that the trailing slash is important here, and that > we should not drop it when passing the path to match_pathname. I'm > still trying to figure out exactly what it is that the extra slash check > is for, and whether it might not have the same problem. The "may not end with a trailing slash" can only happen when baselen == 0. And that rule is documented in code, at this line in last_exclude_matching_from_list: assert(x->baselen == 0 || x->base[x->baselen - 1] == '/'); -- Duy