Skip to content

Commit a0d09c5

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 673af41 commit a0d09c5

File tree

3 files changed

+58
-50
lines changed

3 files changed

+58
-50
lines changed

repo-settings.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "git-compat-util.h"
22
#include "config.h"
3+
#include "repo-settings.h"
34
#include "repository.h"
45
#include "midx.h"
56

repo-settings.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#define REPOSITORY_H
33

44
#include "strmap.h"
5+
#include "repo-settings.h"
56

67
struct config_set;
7-
struct fsmonitor_settings;
88
struct git_hash_algo;
99
struct index_state;
1010
struct lock_file;
@@ -14,59 +14,12 @@ struct submodule_cache;
1414
struct promisor_remote_config;
1515
struct remote_state;
1616

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-
2917
enum ref_storage_format {
3018
REF_STORAGE_FORMAT_UNKNOWN,
3119
REF_STORAGE_FORMAT_FILES,
3220
REF_STORAGE_FORMAT_REFTABLE,
3321
};
3422

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-
7023
struct repo_path_cache {
7124
char *squash_msg;
7225
char *merge_msg;
@@ -273,8 +226,6 @@ int repo_read_index_unmerged(struct repository *);
273226
*/
274227
void repo_update_index_if_able(struct repository *, struct lock_file *);
275228

276-
void prepare_repo_settings(struct repository *r);
277-
278229
/*
279230
* Return 1 if upgrade repository format to target_version succeeded,
280231
* 0 if no upgrade is necessary, and -1 when upgrade is not possible.

0 commit comments

Comments
 (0)