[RFC PATCH v4 04/10] unpack-trees: rename "dir" to "private_dir"
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-10-04 01:12:14
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Elijah Newren <redacted> Until the introduction of the "preserve_ignored" flag in the preceding commit callers who wanted its behavior needed to adjust "dir.flags" and call setup_standard_excludes() themselves. Now that we have no external users of "dir" anymore let's rename it to "private_dir" and add a comment indicating that we'd like it not to be messed with by external callers. This should avoid avoid accidental misuse or confusion over its ownership. Signed-off-by: Elijah Newren <redacted> Signed-off-by: Ævar Arnfjörð Bjarmason <redacted> --- unpack-trees.c | 10 +++++----- unpack-trees.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index 02bc999c6c3..512011cfa42 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c@@ -196,7 +196,7 @@ void unpack_trees_options_init(struct unpack_trees_options *o) void unpack_trees_options_release(struct unpack_trees_options *opts) { strvec_clear(&opts->msgs_to_free); - dir_clear(&opts->dir); + dir_clear(&opts->private_dir); } static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
@@ -1712,8 +1712,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options } if (!o->preserve_ignored) { - o->dir.flags |= DIR_SHOW_IGNORED; - setup_standard_excludes(&o->dir); + o->private_dir.flags |= DIR_SHOW_IGNORED; + setup_standard_excludes(&o->private_dir); } if (!core_apply_sparse_checkout || !o->update)
@@ -2141,7 +2141,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce, */ pathbuf = xstrfmt("%.*s/", namelen, ce->name); - d.exclude_per_dir = o->dir.exclude_per_dir; + d.exclude_per_dir = o->private_dir.exclude_per_dir; i = read_directory(&d, o->src_index, pathbuf, namelen+1, NULL); dir_clear(&d); free(pathbuf);
@@ -2183,7 +2183,7 @@ static int check_ok_to_remove(const char *name, int len, int dtype, if (ignore_case && icase_exists(o, name, len, st)) return 0; - if (is_excluded(&o->dir, o->src_index, name, &dtype)) + if (is_excluded(&o->private_dir, o->src_index, name, &dtype)) /* * ce->name is explicitly excluded, so it is Ok to * overwrite it.
diff --git a/unpack-trees.h b/unpack-trees.h
index 65a8d99d4ef..2eb633bf771 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h@@ -70,7 +70,7 @@ struct unpack_trees_options { dry_run; const char *prefix; int cache_bottom; - struct dir_struct dir; + struct dir_struct private_dir; /* for internal use only */ struct pathspec *pathspec; merge_fn_t fn; const char *msgs[NB_UNPACK_TREES_WARNING_TYPES];
@@ -97,7 +97,7 @@ struct unpack_trees_options { #define UNPACK_TREES_OPTIONS_INIT { \ .msgs_to_free = STRVEC_INIT, \ - .dir = DIR_INIT, \ + .private_dir = DIR_INIT, \ } void unpack_trees_options_init(struct unpack_trees_options *o);
--
2.33.0.1404.g83021034c5d