Skip to content

Commit 4eeed27

Browse files
committed
Merge branch 'bw/dir-c-stops-relying-on-the-index'
API update. * bw/dir-c-stops-relying-on-the-index: dir: convert fill_directory to take an index dir: convert read_directory to take an index dir: convert read_directory_recursive to take an index dir: convert open_cached_dir to take an index dir: convert is_excluded to take an index dir: convert prep_exclude to take an index dir: convert add_excludes to take an index dir: convert is_excluded_from_list to take an index dir: convert last_exclude_matching_from_list to take an index dir: convert dir_add* to take an index dir: convert get_dtype to take index dir: convert directory_exists_in_index to take index dir: convert read_skip_worktree_file_from_index to take an index dir: stop using the index compatibility macros
2 parents f1101ce + 0d32c18 commit 4eeed27

File tree

9 files changed

+151
-108
lines changed

9 files changed

+151
-108
lines changed

builtin/add.c

Lines changed: 4 additions & 3 deletions
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
}
@@ -436,8 +436,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
436436
!file_exists(path))) {
437437
if (ignore_missing) {
438438
int dtype = DT_UNKNOWN;
439-
if (is_excluded(&dir, path, &dtype))
440-
dir_add_ignored(&dir, path, pathspec.items[i].len);
439+
if (is_excluded(&dir, &the_index, path, &dtype))
440+
dir_add_ignored(&dir, &the_index,
441+
path, pathspec.items[i].len);
441442
} else
442443
die(_("pathspec '%s' did not match any files"),
443444
pathspec.items[i].original);

builtin/check-ignore.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ static int check_ignore(struct dir_struct *dir,
101101
full_path = pathspec.items[i].match;
102102
exclude = NULL;
103103
if (!seen[i]) {
104-
exclude = last_exclude_matching(dir, full_path, &dtype);
104+
exclude = last_exclude_matching(dir, &the_index,
105+
full_path, &dtype);
105106
}
106107
if (!quiet && (exclude || show_non_matching))
107108
output_exclude(pathspec.items[i].original, exclude);

builtin/clean.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static int filter_by_patterns_cmd(void)
683683
for_each_string_list_item(item, &del_list) {
684684
int dtype = DT_UNKNOWN;
685685

686-
if (is_excluded(&dir, item->string, &dtype)) {
686+
if (is_excluded(&dir, &the_index, item->string, &dtype)) {
687687
*item->string = '\0';
688688
changed++;
689689
}
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static void show_ru_info(void)
322322
static int ce_excluded(struct dir_struct *dir, const struct cache_entry *ce)
323323
{
324324
int dtype = ce_to_dtype(ce);
325-
return is_excluded(dir, ce->name, &dtype);
325+
return is_excluded(dir, &the_index, ce->name, &dtype);
326326
}
327327

328328
static void show_files(struct dir_struct *dir)
@@ -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)

0 commit comments

Comments
 (0)