Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/dir.h
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2023-02-27 18:28:10 +0300
committerJunio C Hamano <gitster@pobox.com>2023-02-27 19:29:50 +0300
commit5fdf285e6254fff4d9560f72878456f0a53e2e38 (patch)
treed19ec4e6e5651f5ca7f9b5e98ae633d3f3c49b23 /dir.h
parentb413a827126abd54fa95470be7c63fa4f00d5d47 (diff)
dir: separate public from internal portion of dir_struct
In order to make it clearer to callers what portions of dir_struct are public API, and avoid errors from them setting fields that are meant as internal API, split the fields used for internal implementation reasons into a separate embedded struct. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.h')
-rw-r--r--dir.h86
1 files changed, 46 insertions, 40 deletions
diff --git a/dir.h b/dir.h
index 8acfc04418..33fd848fc8 100644
--- a/dir.h
+++ b/dir.h
@@ -215,14 +215,9 @@ struct dir_struct {
/* The number of members in `entries[]` array. */
int nr;
- /* Internal use; keeps track of allocation of `entries[]` array.*/
- int alloc;
-
/* The number of members in `ignored[]` array. */
int ignored_nr;
- int ignored_alloc;
-
/* bit-field of options */
enum {
@@ -296,51 +291,62 @@ struct dir_struct {
*/
struct dir_entry **ignored;
+ /* Enable/update untracked file cache if set */
+ struct untracked_cache *untracked;
+
/**
* The name of the file to be read in each directory for excluded files
* (typically `.gitignore`).
*/
const char *exclude_per_dir;
- /*
- * We maintain three groups of exclude pattern lists:
- *
- * EXC_CMDL lists patterns explicitly given on the command line.
- * EXC_DIRS lists patterns obtained from per-directory ignore files.
- * EXC_FILE lists patterns from fallback ignore files, e.g.
- * - .git/info/exclude
- * - core.excludesfile
- *
- * Each group contains multiple exclude lists, a single list
- * per source.
- */
+ struct dir_struct_internal {
+ /* Keeps track of allocation of `entries[]` array.*/
+ int alloc;
+
+ /* Keeps track of allocation of `ignored[]` array. */
+ int ignored_alloc;
+
+ /*
+ * We maintain three groups of exclude pattern lists:
+ *
+ * EXC_CMDL lists patterns explicitly given on the command line.
+ * EXC_DIRS lists patterns obtained from per-directory ignore
+ * files.
+ * EXC_FILE lists patterns from fallback ignore files, e.g.
+ * - .git/info/exclude
+ * - core.excludesfile
+ *
+ * Each group contains multiple exclude lists, a single list
+ * per source.
+ */
#define EXC_CMDL 0
#define EXC_DIRS 1
#define EXC_FILE 2
- struct exclude_list_group exclude_list_group[3];
-
- /*
- * Temporary variables which are used during loading of the
- * per-directory exclude lists.
- *
- * exclude_stack points to the top of the exclude_stack, and
- * basebuf contains the full path to the current
- * (sub)directory in the traversal. Exclude points to the
- * matching exclude struct if the directory is excluded.
- */
- struct exclude_stack *exclude_stack;
- struct path_pattern *pattern;
- struct strbuf basebuf;
-
- /* Enable untracked file cache if set */
- struct untracked_cache *untracked;
- struct oid_stat ss_info_exclude;
- struct oid_stat ss_excludes_file;
- unsigned unmanaged_exclude_files;
+ struct exclude_list_group exclude_list_group[3];
- /* Stats about the traversal */
- unsigned visited_paths;
- unsigned visited_directories;
+ /*
+ * Temporary variables which are used during loading of the
+ * per-directory exclude lists.
+ *
+ * exclude_stack points to the top of the exclude_stack, and
+ * basebuf contains the full path to the current
+ * (sub)directory in the traversal. Exclude points to the
+ * matching exclude struct if the directory is excluded.
+ */
+ struct exclude_stack *exclude_stack;
+ struct path_pattern *pattern;
+ struct strbuf basebuf;
+
+ /* Additional metadata related to 'untracked' */
+ struct oid_stat ss_info_exclude;
+ struct oid_stat ss_excludes_file;
+ unsigned unmanaged_exclude_files;
+
+ /* Stats about the traversal */
+ unsigned visited_paths;
+ unsigned visited_directories;
+ } internal;
};
#define DIR_INIT { 0 }