mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-04 17:48:27 +00:00
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".
This commit is contained in:
parent
9486d20336
commit
ef6d072236
@ -410,6 +410,14 @@ bool git_attr_fnmatch__match(
|
||||
else
|
||||
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);
|
||||
path->basename[-1] = '/';
|
||||
return (matchval != FNM_NOMATCH);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user