| 270 | } |
| 271 | |
| 272 | int fill_directory(struct dir_struct *dir, |
| 273 | struct index_state *istate, |
| 274 | const struct pathspec *pathspec) |
| 275 | { |
| 276 | const char *prefix; |
| 277 | size_t prefix_len; |
| 278 | |
| 279 | unsigned exclusive_flags = DIR_SHOW_IGNORED | DIR_SHOW_IGNORED_TOO; |
| 280 | if ((dir->flags & exclusive_flags) == exclusive_flags) |
| 281 | BUG("DIR_SHOW_IGNORED and DIR_SHOW_IGNORED_TOO are exclusive"); |
| 282 | |
| 283 | /* |
| 284 | * Calculate common prefix for the pathspec, and |
| 285 | * use that to optimize the directory walk |
| 286 | */ |
| 287 | prefix_len = common_prefix_len(pathspec); |
| 288 | prefix = prefix_len ? pathspec->items[0].match : ""; |
| 289 | |
| 290 | /* Read the directory and prune it */ |
| 291 | read_directory(dir, istate, prefix, prefix_len, pathspec); |
| 292 | |
| 293 | return prefix_len; |
| 294 | } |
| 295 | |
| 296 | int within_depth(const char *name, int namelen, |
| 297 | int depth, int max_depth) |
no test coverage detected