From 9e58becab9d2512bad0fdf150fedbea84d6b9b03 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Fri, 5 May 2017 12:53:25 -0700 Subject: dir: convert dir_add* to take an index Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- builtin/add.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/add.c b/builtin/add.c index 9f53f020d0..bf5e676e46 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -437,7 +437,8 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (ignore_missing) { int dtype = DT_UNKNOWN; if (is_excluded(&dir, path, &dtype)) - dir_add_ignored(&dir, path, pathspec.items[i].len); + dir_add_ignored(&dir, &the_index, + path, pathspec.items[i].len); } else die(_("pathspec '%s' did not match any files"), pathspec.items[i].original); -- cgit v1.2.3 From a0bba65b107651946431bee4c71d05d812988d9d Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Fri, 5 May 2017 12:53:30 -0700 Subject: dir: convert is_excluded to take an index Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- builtin/add.c | 2 +- builtin/check-ignore.c | 3 ++- builtin/clean.c | 2 +- builtin/ls-files.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'builtin') diff --git a/builtin/add.c b/builtin/add.c index bf5e676e46..0b52aeced3 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -436,7 +436,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) !file_exists(path))) { if (ignore_missing) { int dtype = DT_UNKNOWN; - if (is_excluded(&dir, path, &dtype)) + if (is_excluded(&dir, &the_index, path, &dtype)) dir_add_ignored(&dir, &the_index, path, pathspec.items[i].len); } else diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 1d73d3ca3d..d2293b22e1 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -101,7 +101,8 @@ static int check_ignore(struct dir_struct *dir, full_path = pathspec.items[i].match; exclude = NULL; if (!seen[i]) { - exclude = last_exclude_matching(dir, full_path, &dtype); + exclude = last_exclude_matching(dir, &the_index, + full_path, &dtype); } if (!quiet && (exclude || show_non_matching)) output_exclude(pathspec.items[i].original, exclude); diff --git a/builtin/clean.c b/builtin/clean.c index d861f836a2..39866afab4 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -683,7 +683,7 @@ static int filter_by_patterns_cmd(void) for_each_string_list_item(item, &del_list) { int dtype = DT_UNKNOWN; - if (is_excluded(&dir, item->string, &dtype)) { + if (is_excluded(&dir, &the_index, item->string, &dtype)) { *item->string = '\0'; changed++; } diff --git a/builtin/ls-files.c b/builtin/ls-files.c index a6c70dbe9e..7a8c5681b6 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -322,7 +322,7 @@ static void show_ru_info(void) static int ce_excluded(struct dir_struct *dir, const struct cache_entry *ce) { int dtype = ce_to_dtype(ce); - return is_excluded(dir, ce->name, &dtype); + return is_excluded(dir, &the_index, ce->name, &dtype); } static void show_files(struct dir_struct *dir) -- cgit v1.2.3 From 0d32c183b636ffba6462b21ed0c844b6cb887b3f Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Fri, 5 May 2017 12:53:34 -0700 Subject: dir: convert fill_directory to take an index Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- builtin/add.c | 2 +- builtin/clean.c | 2 +- builtin/grep.c | 2 +- builtin/ls-files.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'builtin') diff --git a/builtin/add.c b/builtin/add.c index 0b52aeced3..36cad00ae6 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -400,7 +400,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) } /* This picks up the paths that are not tracked */ - baselen = fill_directory(&dir, &pathspec); + baselen = fill_directory(&dir, &the_index, &pathspec); if (pathspec.nr) seen = prune_directory(&dir, &pathspec, baselen); } diff --git a/builtin/clean.c b/builtin/clean.c index 39866afab4..329b68c40b 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -930,7 +930,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix) PATHSPEC_PREFER_CWD, prefix, argv); - fill_directory(&dir, &pathspec); + fill_directory(&dir, &the_index, &pathspec); for (i = 0; i < dir.nr; i++) { struct dir_entry *ent = dir.entries[i]; diff --git a/builtin/grep.c b/builtin/grep.c index 3ffb5b4e81..f2829629b6 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -866,7 +866,7 @@ static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec, if (exc_std) setup_standard_excludes(&dir); - fill_directory(&dir, pathspec); + fill_directory(&dir, &the_index, pathspec); for (i = 0; i < dir.nr; i++) { if (!dir_path_match(dir.entries[i], pathspec, 0, NULL)) continue; diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 7a8c5681b6..61271b52cf 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -333,7 +333,7 @@ static void show_files(struct dir_struct *dir) if (show_others || show_killed) { if (!show_others) dir->flags |= DIR_COLLECT_KILLED_ONLY; - fill_directory(dir, &pathspec); + fill_directory(dir, &the_index, &pathspec); if (show_others) show_other_files(dir); if (show_killed) -- cgit v1.2.3