]> git.ipfire.org Git - thirdparty/git.git/commitdiff
repo-settings: split out declarations into a standalone header
authorPatrick Steinhardt <ps@pks.im>
Thu, 12 Sep 2024 11:30:04 +0000 (13:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Sep 2024 17:15:42 +0000 (10:15 -0700)
While we have "repo-settings.c", we do not have a corresponding
"repo-settings.h" file. Instead, this functionality is part of the
"repository.h" header, making it hard to discover.

Split the declarations out of "repository.h" and create a standalone
header file with them.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
repo-settings.c
repo-settings.h [new file with mode: 0644]
repository.h

index 2b4e68731bedce7c732508cfab530cb50076fa87..6165546e80abd56fdde88d266de363f565f367d5 100644 (file)
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "config.h"
+#include "repo-settings.h"
 #include "repository.h"
 #include "midx.h"
 
diff --git a/repo-settings.h b/repo-settings.h
new file mode 100644 (file)
index 0000000..ff20a96
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef REPO_SETTINGS_H
+#define REPO_SETTINGS_H
+
+struct fsmonitor_settings;
+struct repository;
+
+enum untracked_cache_setting {
+       UNTRACKED_CACHE_KEEP,
+       UNTRACKED_CACHE_REMOVE,
+       UNTRACKED_CACHE_WRITE,
+};
+
+enum fetch_negotiation_setting {
+       FETCH_NEGOTIATION_CONSECUTIVE,
+       FETCH_NEGOTIATION_SKIPPING,
+       FETCH_NEGOTIATION_NOOP,
+};
+
+struct repo_settings {
+       int initialized;
+
+       int core_commit_graph;
+       int commit_graph_generation_version;
+       int commit_graph_changed_paths_version;
+       int gc_write_commit_graph;
+       int fetch_write_commit_graph;
+       int command_requires_full_index;
+       int sparse_index;
+       int pack_read_reverse_index;
+       int pack_use_bitmap_boundary_traversal;
+       int pack_use_multi_pack_reuse;
+
+       /*
+        * Does this repository have core.useReplaceRefs=true (on by
+        * default)? This provides a repository-scoped version of this
+        * config, though it could be disabled process-wide via some Git
+        * builtins or the --no-replace-objects option. See
+        * replace_refs_enabled() for more details.
+        */
+       int read_replace_refs;
+
+       struct fsmonitor_settings *fsmonitor; /* lazily loaded */
+
+       int index_version;
+       int index_skip_hash;
+       enum untracked_cache_setting core_untracked_cache;
+
+       int pack_use_sparse;
+       enum fetch_negotiation_setting fetch_negotiation_algorithm;
+
+       int core_multi_pack_index;
+};
+
+void prepare_repo_settings(struct repository *r);
+
+#endif /* REPO_SETTINGS_H */
index c603e969ae758713d9347243b3e4f954ca25d2cf..24a66a496a6ff516ce06d47b7329b3d36eb701ca 100644 (file)
@@ -2,9 +2,9 @@
 #define REPOSITORY_H
 
 #include "strmap.h"
+#include "repo-settings.h"
 
 struct config_set;
-struct fsmonitor_settings;
 struct git_hash_algo;
 struct index_state;
 struct lock_file;
@@ -14,59 +14,12 @@ struct submodule_cache;
 struct promisor_remote_config;
 struct remote_state;
 
-enum untracked_cache_setting {
-       UNTRACKED_CACHE_KEEP,
-       UNTRACKED_CACHE_REMOVE,
-       UNTRACKED_CACHE_WRITE,
-};
-
-enum fetch_negotiation_setting {
-       FETCH_NEGOTIATION_CONSECUTIVE,
-       FETCH_NEGOTIATION_SKIPPING,
-       FETCH_NEGOTIATION_NOOP,
-};
-
 enum ref_storage_format {
        REF_STORAGE_FORMAT_UNKNOWN,
        REF_STORAGE_FORMAT_FILES,
        REF_STORAGE_FORMAT_REFTABLE,
 };
 
-struct repo_settings {
-       int initialized;
-
-       int core_commit_graph;
-       int commit_graph_generation_version;
-       int commit_graph_changed_paths_version;
-       int gc_write_commit_graph;
-       int fetch_write_commit_graph;
-       int command_requires_full_index;
-       int sparse_index;
-       int pack_read_reverse_index;
-       int pack_use_bitmap_boundary_traversal;
-       int pack_use_multi_pack_reuse;
-
-       /*
-        * Does this repository have core.useReplaceRefs=true (on by
-        * default)? This provides a repository-scoped version of this
-        * config, though it could be disabled process-wide via some Git
-        * builtins or the --no-replace-objects option. See
-        * replace_refs_enabled() for more details.
-        */
-       int read_replace_refs;
-
-       struct fsmonitor_settings *fsmonitor; /* lazily loaded */
-
-       int index_version;
-       int index_skip_hash;
-       enum untracked_cache_setting core_untracked_cache;
-
-       int pack_use_sparse;
-       enum fetch_negotiation_setting fetch_negotiation_algorithm;
-
-       int core_multi_pack_index;
-};
-
 struct repo_path_cache {
        char *squash_msg;
        char *merge_msg;
@@ -273,8 +226,6 @@ int repo_read_index_unmerged(struct repository *);
  */
 void repo_update_index_if_able(struct repository *, struct lock_file *);
 
-void prepare_repo_settings(struct repository *r);
-
 /*
  * Return 1 if upgrade repository format to target_version succeeded,
  * 0 if no upgrade is necessary, and -1 when upgrade is not possible.