Skip to content

Commit 0d32c18

Browse files
bmwillgitster
authored andcommitted
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>
1 parent 2c1eb10 commit 0d32c18

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
400400
}
401401

402402
/* This picks up the paths that are not tracked */
403-
baselen = fill_directory(&dir, &pathspec);
403+
baselen = fill_directory(&dir, &the_index, &pathspec);
404404
if (pathspec.nr)
405405
seen = prune_directory(&dir, &pathspec, baselen);
406406
}

builtin/clean.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
930930
PATHSPEC_PREFER_CWD,
931931
prefix, argv);
932932

933-
fill_directory(&dir, &pathspec);
933+
fill_directory(&dir, &the_index, &pathspec);
934934

935935
for (i = 0; i < dir.nr; i++) {
936936
struct dir_entry *ent = dir.entries[i];

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
866866
if (exc_std)
867867
setup_standard_excludes(&dir);
868868

869-
fill_directory(&dir, pathspec);
869+
fill_directory(&dir, &the_index, pathspec);
870870
for (i = 0; i < dir.nr; i++) {
871871
if (!dir_path_match(dir.entries[i], pathspec, 0, NULL))
872872
continue;

builtin/ls-files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static void show_files(struct dir_struct *dir)
333333
if (show_others || show_killed) {
334334
if (!show_others)
335335
dir->flags |= DIR_COLLECT_KILLED_ONLY;
336-
fill_directory(dir, &pathspec);
336+
fill_directory(dir, &the_index, &pathspec);
337337
if (show_others)
338338
show_other_files(dir);
339339
if (show_killed)

dir.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ char *common_prefix(const struct pathspec *pathspec)
177177
return len ? xmemdupz(pathspec->items[0].match, len) : NULL;
178178
}
179179

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)
181183
{
182184
const char *prefix;
183185
size_t prefix_len;
@@ -190,7 +192,7 @@ int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec)
190192
prefix = prefix_len ? pathspec->items[0].match : "";
191193

192194
/* 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);
194196

195197
return prefix_len;
196198
}

dir.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ extern int match_pathspec(const struct pathspec *pathspec,
214214
extern int report_path_error(const char *ps_matched, const struct pathspec *pathspec, const char *prefix);
215215
extern int within_depth(const char *name, int namelen, int depth, int max_depth);
216216

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);
218220
extern int read_directory(struct dir_struct *, struct index_state *istate,
219221
const char *path, int len,
220222
const struct pathspec *pathspec);

wt-status.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
665665
dir.untracked = the_index.untracked;
666666
setup_standard_excludes(&dir);
667667

668-
fill_directory(&dir, &s->pathspec);
668+
fill_directory(&dir, &the_index, &s->pathspec);
669669

670670
for (i = 0; i < dir.nr; i++) {
671671
struct dir_entry *ent = dir.entries[i];

0 commit comments

Comments
 (0)