summaryrefslogtreecommitdiffstats
path: root/repo-settings.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-12-03 15:44:01 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-04 00:21:55 +0100
commitd6b2d21fbf269db7a6be56d28a62cb65a7d7a660 (patch)
tree9994ba164b0228e0b761173f28d884ffbdca7edc /repo-settings.c
parentpackfile: pass down repository to `for_each_packed_object` (diff)
downloadgit-d6b2d21fbf269db7a6be56d28a62cb65a7d7a660.tar.xz
git-d6b2d21fbf269db7a6be56d28a62cb65a7d7a660.zip
config: make `delta_base_cache_limit` a non-global variable
The `delta_base_cache_limit` variable is a global config variable used by multiple subsystems. Let's make this non-global, by adding this variable independently to the subsystems where it is used. First, add the setting to the `repo_settings` struct, this provides access to the config in places where the repository is available. Use this in `packfile.c`. In `index-pack.c` we add it to the `pack_idx_option` struct and its constructor. While the repository struct is available here, it may not be set because `git index-pack` can be used without a repository. In `gc.c` add it to the `gc_config` struct and also the constructor function. The gc functions currently do not have direct access to a repository struct. These changes are made to remove the usage of `delta_base_cache_limit` as a global variable in `packfile.c`. This brings us one step closer to removing the `USE_THE_REPOSITORY_VARIABLE` definition in `packfile.c` which we complete in the next patch. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repo-settings.c')
-rw-r--r--repo-settings.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/repo-settings.c b/repo-settings.c
index 4699b4b365..acc27eb8fe 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -3,6 +3,7 @@
#include "repo-settings.h"
#include "repository.h"
#include "midx.h"
+#include "pack-objects.h"
static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
int def)
@@ -26,6 +27,7 @@ void prepare_repo_settings(struct repository *r)
const char *strval;
int manyfiles;
int read_changed_paths;
+ unsigned long ulongval;
if (!r->gitdir)
BUG("Cannot add settings for uninitialized repository");
@@ -123,6 +125,9 @@ void prepare_repo_settings(struct repository *r)
* removed.
*/
r->settings.command_requires_full_index = 1;
+
+ if (!repo_config_get_ulong(r, "core.deltabasecachelimit", &ulongval))
+ r->settings.delta_base_cache_limit = ulongval;
}
enum log_refs_config repo_settings_get_log_all_ref_updates(struct repository *repo)