dir: convert fill_directory to take an index

Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed May 5, 2017 at 12:53 UTC 0d32c183b636ffba6462b21ed0c844b6cb887b3f
7 files changed +12 -8
builtin/add.c
+1 -1
@@ -400,7 +400,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
400 }
401
402 /* This picks up the paths that are not tracked */
403 - baselen = fill_directory(&dir, &pathspec);
403 + baselen = fill_directory(&dir, &the_index, &pathspec);
404 if (pathspec.nr)
405 seen = prune_directory(&dir, &pathspec, baselen);
406 }
builtin/clean.c
+1 -1
@@ -930,7 +930,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
930 PATHSPEC_PREFER_CWD,
931 prefix, argv);
932
933 - fill_directory(&dir, &pathspec);
933 + fill_directory(&dir, &the_index, &pathspec);
934
935 for (i = 0; i < dir.nr; i++) {
936 struct dir_entry *ent = dir.entries[i];
builtin/grep.c
+1 -1
@@ -866,7 +866,7 @@ static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
866 if (exc_std)
867 setup_standard_excludes(&dir);
868
869 - fill_directory(&dir, pathspec);
869 + fill_directory(&dir, &the_index, pathspec);
870 for (i = 0; i < dir.nr; i++) {
871 if (!dir_path_match(dir.entries[i], pathspec, 0, NULL))
872 continue;
builtin/ls-files.c
+1 -1
@@ -333,7 +333,7 @@ static void show_files(struct dir_struct *dir)
333 if (show_others || show_killed) {
334 if (!show_others)
335 dir->flags |= DIR_COLLECT_KILLED_ONLY;
336 - fill_directory(dir, &pathspec);
336 + fill_directory(dir, &the_index, &pathspec);
337 if (show_others)
338 show_other_files(dir);
339 if (show_killed)
dir.c
+4 -2
@@ -177,7 +177,9 @@ char *common_prefix(const struct pathspec *pathspec)
177 return len ? xmemdupz(pathspec->items[0].match, len) : NULL;
178 }
179
180 -int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec)
180 +int fill_directory(struct dir_struct *dir,
181 + struct index_state *istate,
182 + const struct pathspec *pathspec)
183 {
184 const char *prefix;
185 size_t prefix_len;
@@ -190,7 +192,7 @@ int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec)
192 prefix = prefix_len ? pathspec->items[0].match : "";
193
194 /* Read the directory and prune it */
193 - read_directory(dir, &the_index, prefix, prefix_len, pathspec);
195 + read_directory(dir, istate, prefix, prefix_len, pathspec);
196
197 return prefix_len;
198 }
dir.h
+3 -1
@@ -214,7 +214,9 @@ extern int match_pathspec(const struct pathspec *pathspec,
214 extern int report_path_error(const char *ps_matched, const struct pathspec *pathspec, const char *prefix);
215 extern int within_depth(const char *name, int namelen, int depth, int max_depth);
216
217 -extern int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec);
217 +extern int fill_directory(struct dir_struct *dir,
218 + struct index_state *istate,
219 + const struct pathspec *pathspec);
220 extern int read_directory(struct dir_struct *, struct index_state *istate,
221 const char *path, int len,
222 const struct pathspec *pathspec);
wt-status.c
+1 -1
@@ -665,7 +665,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
665 dir.untracked = the_index.untracked;
666 setup_standard_excludes(&dir);
667
668 - fill_directory(&dir, &s->pathspec);
668 + fill_directory(&dir, &the_index, &s->pathspec);
669
670 for (i = 0; i < dir.nr; i++) {
671 struct dir_entry *ent = dir.entries[i];