* 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. */
| 1349 | * directory entry. |
| 1350 | */ |
| 1351 | static 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 | |
| 1367 | static struct cache_entry *find_cache_entry(struct traverse_info *info, |
| 1368 | const struct name_entry *p) |
no outgoing calls
no test coverage detected