diff options
author | Mike McQuaid <mike@mikemcquaid.com> | 2015-04-17 18:27:28 -0700 |
---|---|---|
committer | Carlos MartÃn Nieto <cmn@dwim.me> | 2015-05-18 21:06:04 +0200 |
commit | b67bc364f51c2b8794470ba2e04f136e53be033f (patch) | |
tree | 77769038d193608450c2e6c1f507487a8172c2f7 | |
parent | 657ddf9701519e7bb221e88a0a936a943d5f5ecd (diff) | |
download | libgit2-b67bc364f51c2b8794470ba2e04f136e53be033f.tar.gz |
attr_file: fix subdirectory attr case.
Closes #2966.
-rw-r--r-- | src/attr_file.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index 5b008b0e3..c0c99aa18 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -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) || @@ -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); } |