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

Function match_basename

dir.c:1328–1350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1326}
1327
1328int match_basename(const char *basename, int basenamelen,
1329 const char *pattern, int prefix, int patternlen,
1330 unsigned flags)
1331{
1332 if (prefix == patternlen) {
1333 if (patternlen == basenamelen &&
1334 !fspathncmp(pattern, basename, basenamelen))
1335 return 1;
1336 } else if (flags & PATTERN_FLAG_ENDSWITH) {
1337 /* "*literal" matching against "fooliteral" */
1338 if (patternlen - 1 <= basenamelen &&
1339 !fspathncmp(pattern + 1,
1340 basename + basenamelen - (patternlen - 1),
1341 patternlen - 1))
1342 return 1;
1343 } else {
1344 if (fnmatch_icase_mem(pattern, patternlen,
1345 basename, basenamelen,
1346 0) == 0)
1347 return 1;
1348 }
1349 return 0;
1350}
1351
1352int match_pathname(const char *pathname, int pathlen,
1353 const char *base, int baselen,

Callers 2

path_matchesFunction · 0.85

Calls 1

fnmatch_icase_memFunction · 0.85

Tested by

no test coverage detected