Commit ef6d0722 by Edward Thomson

attr: don't match files for folders

When ignoring a path "foo/", ensure that this is actually a directory,
and not simply a file named "foo".
parent 9486d203
...@@ -410,6 +410,14 @@ bool git_attr_fnmatch__match( ...@@ -410,6 +410,14 @@ bool git_attr_fnmatch__match(
else else
matchpath = path->path; matchpath = path->path;
/* fail match if this is a file with same name as ignored folder */
bool samename = (match->flags & GIT_ATTR_FNMATCH_ICASE) ?
!strcasecmp(match->pattern, matchpath) :
!strcmp(match->pattern, matchpath);
if (samename)
return false;
matchval = p_fnmatch(match->pattern, matchpath, flags); matchval = p_fnmatch(match->pattern, matchpath, flags);
path->basename[-1] = '/'; path->basename[-1] = '/';
return (matchval != FNM_NOMATCH); return (matchval != FNM_NOMATCH);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment