Raw
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 core_diff_hunks;
26 int gc_write_commit_graph;
27 int fetch_write_commit_graph;
28 int command_requires_full_index;
29 int sparse_index;
30 int pack_read_reverse_index;
31 int pack_use_bitmap_boundary_traversal;
32 int pack_use_multi_pack_reuse;
33
34 int shared_repository;
35 int shared_repository_initialized;
36
37 /*
38 * Does this repository have core.useReplaceRefs=true (on by
39 * default)? This provides a repository-scoped version of this
40 * config, though it could be disabled process-wide via some Git
41 * builtins or the --no-replace-objects option. See
42 * replace_refs_enabled() for more details.
43 */
44 int read_replace_refs;
45
46 struct fsmonitor_settings *fsmonitor; /* lazily loaded */
47
48 int index_version;
49 int index_skip_hash;
50 enum untracked_cache_setting core_untracked_cache;
51
52 int pack_use_sparse;
53 int pack_use_path_walk;
54 enum fetch_negotiation_setting fetch_negotiation_algorithm;
55
56 int core_multi_pack_index;
57 int warn_ambiguous_refs; /* lazily loaded via accessor */
58
59 size_t delta_base_cache_limit;
60 size_t packed_git_window_size;
61 size_t packed_git_limit;
62 unsigned long big_file_threshold;
63
64 int max_allowed_tree_depth;
65
66 char *hooks_path;
67 };
68 #define REPO_SETTINGS_INIT { \
69 .shared_repository = -1, \
70 .index_version = -1, \
71 .core_untracked_cache = UNTRACKED_CACHE_KEEP, \
72 .fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE, \
73 .warn_ambiguous_refs = -1, \
74 .delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT, \
75 .packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE, \
76 .packed_git_limit = DEFAULT_PACKED_GIT_LIMIT, \
77 .max_allowed_tree_depth = DEFAULT_MAX_ALLOWED_TREE_DEPTH, \
78 }
79
80 void prepare_repo_settings(struct repository *r);
81 void repo_settings_clear(struct repository *r);
82
83 /* Read the value for "core.warnAmbiguousRefs". */
84 int repo_settings_get_warn_ambiguous_refs(struct repository *repo);
85 /* Read the value for "core.hooksPath". */
86 const char *repo_settings_get_hooks_path(struct repository *repo);
87
88 /* Read and set the value for "core.bigFileThreshold". */
89 unsigned long repo_settings_get_big_file_threshold(struct repository *repo);
90 void repo_settings_set_big_file_threshold(struct repository *repo, unsigned long value);
91
92 /* Read, set or reset the value for "core.sharedRepository". */
93 int repo_settings_get_shared_repository(struct repository *repo);
94 void repo_settings_set_shared_repository(struct repository *repo, int value);
95 void repo_settings_reset_shared_repository(struct repository *repo);
96
97 #endif /* REPO_SETTINGS_H */