Skip to content

Commit

Permalink
attr_file: fix subdirectory attr case.
Browse files Browse the repository at this point in the history
Closes #2966.
  • Loading branch information
MikeMcQuaid authored and carlosmn committed May 18, 2015
1 parent 657ddf9 commit b67bc36
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/attr_file.c
Expand Up @@ -379,6 +379,7 @@ bool git_attr_fnmatch__match(

if ((match->flags & GIT_ATTR_FNMATCH_DIRECTORY) && !path->is_dir) {
int matchval;
char *matchpath;

/* for attribute checks or root ignore checks, fail match */
if (!(match->flags & GIT_ATTR_FNMATCH_IGNORE) ||
Expand All @@ -388,7 +389,13 @@ bool git_attr_fnmatch__match(
/* for ignore checks, use container of current item for check */
path->basename[-1] = '\0';
flags |= FNM_LEADING_DIR;
matchval = p_fnmatch(match->pattern, path->path, flags);

if (match->containing_dir)
matchpath = path->basename;
else
matchpath = path->path;

matchval = p_fnmatch(match->pattern, matchpath, flags);
path->basename[-1] = '/';
return (matchval != FNM_NOMATCH);
}
Expand Down

0 comments on commit b67bc36

Please sign in to comment.