MCPcopy Create free account
hub / github.com/git/git / path_matches

Function path_matches

attr.c:1045–1066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1043}
1044
1045static int path_matches(const char *pathname, int pathlen,
1046 int basename_offset,
1047 const struct pattern *pat,
1048 const char *base, int baselen)
1049{
1050 const char *pattern = pat->pattern;
1051 int prefix = pat->nowildcardlen;
1052 int isdir = (pathlen && pathname[pathlen - 1] == '/');
1053
1054 if ((pat->flags & PATTERN_FLAG_MUSTBEDIR) && !isdir)
1055 return 0;
1056
1057 if (pat->flags & PATTERN_FLAG_NODIR) {
1058 return match_basename(pathname + basename_offset,
1059 pathlen - basename_offset - isdir,
1060 pattern, prefix,
1061 pat->patternlen, pat->flags);
1062 }
1063 return match_pathname(pathname, pathlen - isdir,
1064 base, baselen,
1065 pattern, prefix, pat->patternlen);
1066}
1067
1068struct attr_state_queue {
1069 const struct attr_state **items;

Callers 1

fillFunction · 0.85

Calls 2

match_basenameFunction · 0.85
match_pathnameFunction · 0.85

Tested by

no test coverage detected