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

Function sparse_dir_matches_path

unpack-trees.c:1351–1365  ·  view source on GitHub ↗

* Given a sparse directory entry 'ce', compare ce->name to * info->traverse_path + p->path + '/' if info->traverse_path * is non-empty. * * Compare ce->name to p->path + '/' otherwise. Note that * ce->name must end in a trailing '/' because it is a sparse * directory entry. */

Source from the content-addressed store, hash-verified

1349 * directory entry.
1350 */
1351static int sparse_dir_matches_path(const struct cache_entry *ce,
1352 struct traverse_info *info,
1353 const struct name_entry *p)
1354{
1355 assert(S_ISSPARSEDIR(ce->ce_mode));
1356 assert(ce->name[ce->ce_namelen - 1] == '/');
1357
1358 if (info->pathlen)
1359 return ce->ce_namelen == info->pathlen + p->pathlen + 1 &&
1360 ce->name[info->pathlen - 1] == '/' &&
1361 !strncmp(ce->name, info->traverse_path, info->pathlen) &&
1362 !strncmp(ce->name + info->pathlen, p->path, p->pathlen);
1363 return ce->ce_namelen == p->pathlen + 1 &&
1364 !strncmp(ce->name, p->path, p->pathlen);
1365}
1366
1367static struct cache_entry *find_cache_entry(struct traverse_info *info,
1368 const struct name_entry *p)

Callers 2

find_cache_entryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected