repo-settings: split out declarations into a standalone header

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>

Patrick Steinhardt committed Sep 12, 2024 at 13:30 UTC a0d09c56ba6c2e9fc07a19531e29c43f83c445f7
3 files changed +58 -50
repo-settings.c
+1
@@ -1,5 +1,6 @@
1 #include "git-compat-util.h"
2 #include "config.h"
3 +#include "repo-settings.h"
4 #include "repository.h"
5 #include "midx.h"
6
repo-settings.h new
+56
@@ -0,0 +1,56 @@
1 +#ifndef REPO_SETTINGS_H
2 +#define REPO_SETTINGS_H
3 +
4 +struct fsmonitor_settings;
5 +struct repository;
6 +
7 +enum untracked_cache_setting {
8 + UNTRACKED_CACHE_KEEP,
9 + UNTRACKED_CACHE_REMOVE,
10 + UNTRACKED_CACHE_WRITE,
11 +};
12 +
13 +enum fetch_negotiation_setting {
14 + FETCH_NEGOTIATION_CONSECUTIVE,
15 + FETCH_NEGOTIATION_SKIPPING,
16 + FETCH_NEGOTIATION_NOOP,
17 +};
18 +
19 +struct repo_settings {
20 + int initialized;
21 +
22 + int core_commit_graph;
23 + int commit_graph_generation_version;
24 + int commit_graph_changed_paths_version;
25 + int gc_write_commit_graph;
26 + int fetch_write_commit_graph;
27 + int command_requires_full_index;
28 + int sparse_index;
29 + int pack_read_reverse_index;
30 + int pack_use_bitmap_boundary_traversal;
31 + int pack_use_multi_pack_reuse;
32 +
33 + /*
34 + * Does this repository have core.useReplaceRefs=true (on by
35 + * default)? This provides a repository-scoped version of this
36 + * config, though it could be disabled process-wide via some Git
37 + * builtins or the --no-replace-objects option. See
38 + * replace_refs_enabled() for more details.
39 + */
40 + int read_replace_refs;
41 +
42 + struct fsmonitor_settings *fsmonitor; /* lazily loaded */
43 +
44 + int index_version;
45 + int index_skip_hash;
46 + enum untracked_cache_setting core_untracked_cache;
47 +
48 + int pack_use_sparse;
49 + enum fetch_negotiation_setting fetch_negotiation_algorithm;
50 +
51 + int core_multi_pack_index;
52 +};
53 +
54 +void prepare_repo_settings(struct repository *r);
55 +
56 +#endif /* REPO_SETTINGS_H */
repository.h
+1 -50
@@ -2,9 +2,9 @@
2 #define REPOSITORY_H
3
4 #include "strmap.h"
5 +#include "repo-settings.h"
6
7 struct config_set;
7 -struct fsmonitor_settings;
8 struct git_hash_algo;
9 struct index_state;
10 struct lock_file;
@@ -14,59 +14,12 @@ struct submodule_cache;
14 struct promisor_remote_config;
15 struct remote_state;
16
17 -enum untracked_cache_setting {
18 - UNTRACKED_CACHE_KEEP,
19 - UNTRACKED_CACHE_REMOVE,
20 - UNTRACKED_CACHE_WRITE,
21 -};
22 -
23 -enum fetch_negotiation_setting {
24 - FETCH_NEGOTIATION_CONSECUTIVE,
25 - FETCH_NEGOTIATION_SKIPPING,
26 - FETCH_NEGOTIATION_NOOP,
27 -};
28 -
17 enum ref_storage_format {
18 REF_STORAGE_FORMAT_UNKNOWN,
19 REF_STORAGE_FORMAT_FILES,
20 REF_STORAGE_FORMAT_REFTABLE,
21 };
22
35 -struct repo_settings {
36 - int initialized;
37 -
38 - int core_commit_graph;
39 - int commit_graph_generation_version;
40 - int commit_graph_changed_paths_version;
41 - int gc_write_commit_graph;
42 - int fetch_write_commit_graph;
43 - int command_requires_full_index;
44 - int sparse_index;
45 - int pack_read_reverse_index;
46 - int pack_use_bitmap_boundary_traversal;
47 - int pack_use_multi_pack_reuse;
48 -
49 - /*
50 - * Does this repository have core.useReplaceRefs=true (on by
51 - * default)? This provides a repository-scoped version of this
52 - * config, though it could be disabled process-wide via some Git
53 - * builtins or the --no-replace-objects option. See
54 - * replace_refs_enabled() for more details.
55 - */
56 - int read_replace_refs;
57 -
58 - struct fsmonitor_settings *fsmonitor; /* lazily loaded */
59 -
60 - int index_version;
61 - int index_skip_hash;
62 - enum untracked_cache_setting core_untracked_cache;
63 -
64 - int pack_use_sparse;
65 - enum fetch_negotiation_setting fetch_negotiation_algorithm;
66 -
67 - int core_multi_pack_index;
68 -};
69 -
23 struct repo_path_cache {
24 char *squash_msg;
25 char *merge_msg;
@@ -273,8 +226,6 @@ int repo_read_index_unmerged(struct repository *);
226 */
227 void repo_update_index_if_able(struct repository *, struct lock_file *);
228
276 -void prepare_repo_settings(struct repository *r);
277 -
229 /*
230 * Return 1 if upgrade repository format to target_version succeeded,
231 * 0 if no upgrade is necessary, and -1 when upgrade is not possible.