aboutsummaryrefslogtreecommitdiffstats
path: root/repo-settings.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-12-03 15:44:02 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-04 08:21:55 +0900
commitd284713bae71877577cf1a07501c8528f8c44bb2 (patch)
treed933aa2b54f2d8d92d56b8e9aeaa055404fc9df4 /repo-settings.c
parentd6b2d21fbf269db7a6be56d28a62cb65a7d7a660 (diff)
downloadgit-d284713bae71877577cf1a07501c8528f8c44bb2.tar.gz
config: make `packed_git_(limit|window_size)` non-global variables
The variables `packed_git_window_size` and `packed_git_limit` are global config variables used in the `packfile.c` file. Since it is only used in this file, let's change it from being a global config variable to a local variable for the subsystem. With this, we rid `packfile.c` from all global variable usage and this means we can also remove the `USE_THE_REPOSITORY_VARIABLE` guard from the file. Helped-by: Taylor Blau <me@ttaylorr.com> 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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/repo-settings.c b/repo-settings.c
index acc27eb8fe..9d16d5399e 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -128,6 +128,19 @@ void prepare_repo_settings(struct repository *r)
if (!repo_config_get_ulong(r, "core.deltabasecachelimit", &ulongval))
r->settings.delta_base_cache_limit = ulongval;
+
+ if (!repo_config_get_ulong(r, "core.packedgitwindowsize", &ulongval)) {
+ int pgsz_x2 = getpagesize() * 2;
+
+ /* This value must be multiple of (pagesize * 2) */
+ ulongval /= pgsz_x2;
+ if (ulongval < 1)
+ ulongval = 1;
+ r->settings.packed_git_window_size = ulongval * pgsz_x2;
+ }
+
+ if (!repo_config_get_ulong(r, "core.packedgitlimit", &ulongval))
+ r->settings.packed_git_limit = ulongval;
}
enum log_refs_config repo_settings_get_log_all_ref_updates(struct repository *repo)