Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2 2/2] attr: more matching optimizations from .gitignore

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:59

Junio C Hamano [off-list ref] writes:
Nguyễn Thái Ngọc Duy  [off-list ref] writes:
quoted
   @@ -690,16 +689,18 @@ static int path_matches(const char *pathname, int pathlen,
    	 * contain the trailing slash
    	 */
    
   -	if (pathlen < baselen ||
   +	if (pathlen < baselen + 1 ||
    	    (baselen && pathname[baselen] != '/') ||
   -	    strncmp(pathname, base, baselen))
   +	    strncmp_icase(pathname, base, baselen))
Shouldn't the last comparison be

	strncmp_icase(pathname, base, baselen + 1)

instead, if you are trying to match this part from dir.c where
baselen does count the trailing slash?

		if (pathlen < x->baselen ||
		    (x->baselen && pathname[x->baselen-1] != '/') ||
		    strncmp_icase(pathname, x->base, x->baselen))
			continue;

In other words, relative to what was queued to 'pu', something like
this instead....
Aaaaand,... it doesn't work and breaks t0003.sh.  Sigh...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help