Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--attr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/attr.c b/attr.c
index 4cfe0ee0fc..4d620bc52a 100644
--- a/attr.c
+++ b/attr.c
@@ -661,18 +661,18 @@ static int path_matches(const char *pathname, int pathlen,
{
const char *pattern = pat->pattern;
int prefix = pat->nowildcardlen;
+ int isdir = (pathlen && pathname[pathlen - 1] == '/');
- if ((pat->flags & EXC_FLAG_MUSTBEDIR) &&
- ((!pathlen) || (pathname[pathlen-1] != '/')))
+ if ((pat->flags & EXC_FLAG_MUSTBEDIR) && !isdir)
return 0;
if (pat->flags & EXC_FLAG_NODIR) {
return match_basename(pathname + basename_offset,
- pathlen - basename_offset,
+ pathlen - basename_offset - isdir,
pattern, prefix,
pat->patternlen, pat->flags);
}
- return match_pathname(pathname, pathlen,
+ return match_pathname(pathname, pathlen - isdir,
base, baselen,
pattern, prefix, pat->patternlen, pat->flags);
}