|
19 | 19 | * CE_SKIP_WORKTREE marked. If you want to exclude files, make sure you have |
20 | 20 | * loaded the index first. |
21 | 21 | * |
22 | | - * - Prepare `struct dir_struct dir` and clear it with `memset(&dir, 0, |
23 | | - * sizeof(dir))`. |
| 22 | + * - Prepare `struct dir_struct dir` using `dir_init()` function. |
24 | 23 | * |
25 | 24 | * - To add single exclude pattern, call `add_pattern_list()` and then |
26 | 25 | * `add_pattern()`. |
27 | 26 | * |
28 | 27 | * - To add patterns from a file (e.g. `.git/info/exclude`), call |
29 | | - * `add_patterns_from_file()` , and/or set `dir.exclude_per_dir`. A |
30 | | - * short-hand function `setup_standard_excludes()` can be used to set |
31 | | - * up the standard set of exclude settings. |
| 28 | + * `add_patterns_from_file()` , and/or set `dir.exclude_per_dir`. |
32 | 29 | * |
33 | | - * - Set options described in the Data Structure section above. |
| 30 | + * - A short-hand function `setup_standard_excludes()` can be used to set |
| 31 | + * up the standard set of exclude settings, instead of manually calling |
| 32 | + * the add_pattern*() family of functions. |
34 | 33 | * |
35 | | - * - Call `read_directory()`. |
| 34 | + * - Call `fill_directory()`. |
36 | 35 | * |
37 | | - * - Use `dir.entries[]`. |
| 36 | + * - Use `dir.entries[]` and `dir.ignored[]`. |
38 | 37 | * |
39 | | - * - Call `clear_directory()` when the contained elements are no longer in use. |
| 38 | + * - Call `dir_clear()` when the contained elements are no longer in use. |
40 | 39 | * |
41 | 40 | */ |
42 | 41 |
|
@@ -362,6 +361,8 @@ int match_pathspec(const struct index_state *istate, |
362 | 361 | int report_path_error(const char *ps_matched, const struct pathspec *pathspec); |
363 | 362 | int within_depth(const char *name, int namelen, int depth, int max_depth); |
364 | 363 |
|
| 364 | +void dir_init(struct dir_struct *dir); |
| 365 | + |
365 | 366 | int fill_directory(struct dir_struct *dir, |
366 | 367 | struct index_state *istate, |
367 | 368 | const struct pathspec *pathspec); |
@@ -428,7 +429,7 @@ void parse_path_pattern(const char **string, int *patternlen, unsigned *flags, i |
428 | 429 | void add_pattern(const char *string, const char *base, |
429 | 430 | int baselen, struct pattern_list *pl, int srcpos); |
430 | 431 | void clear_pattern_list(struct pattern_list *pl); |
431 | | -void clear_directory(struct dir_struct *dir); |
| 432 | +void dir_clear(struct dir_struct *dir); |
432 | 433 |
|
433 | 434 | int repo_file_exists(struct repository *repo, const char *path); |
434 | 435 | int file_exists(const char *); |
|
0 commit comments