summaryrefslogtreecommitdiff
path: root/builtin/gc.c
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2021-10-15 20:16:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-15 21:30:10 (GMT)
commita897ab7ed143b2790f05785a3b1916f8a71c7a8c (patch)
treefac7b1d1a3bbd0faacb204e09f360b11c96d1709 /builtin/gc.c
parentdc5570872f684f7c838fe7571225d279243b8700 (diff)
downloadgit-a897ab7ed143b2790f05785a3b1916f8a71c7a8c.zip
git-a897ab7ed143b2790f05785a3b1916f8a71c7a8c.tar.gz
git-a897ab7ed143b2790f05785a3b1916f8a71c7a8c.tar.bz2
gc: perform incremental repack when implictly enabled
builtin/gc.c has two ways of checking if multi-pack-index is enabled: - git_config_get_bool() in incremental_repack_auto_condition() - the_repository->settings.core_multi_pack_index in maintenance_task_incremental_repack() The two implementations have existed since the incremental-repack task was introduced in e841a79a13 (maintenance: add incremental-repack auto condition, 2020-09-25). These two values can diverge because prepare_repo_settings() enables the feature in the_repository->settings by default. In the case where core.multiPackIndex is not set in the config, the auto condition would fail, causing the incremental-repack task to not be run. Because we always want to consider the default values, we should always use the_repository->settings. Standardize on using the_repository->settings.core_multi_pack_index to check if multi-pack-index is enabled. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/gc.c')
-rw-r--r--builtin/gc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index 6b3de3d..2670931 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1049,12 +1049,11 @@ static int maintenance_task_loose_objects(struct maintenance_run_opts *opts)
static int incremental_repack_auto_condition(void)
{
struct packed_git *p;
- int enabled;
int incremental_repack_auto_limit = 10;
int count = 0;
- if (git_config_get_bool("core.multiPackIndex", &enabled) ||
- !enabled)
+ prepare_repo_settings(the_repository);
+ if (!the_repository->settings.core_multi_pack_index)
return 0;
git_config_get_int("maintenance.incremental-repack.auto",