aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-10-24 08:57:17 +0200
committerJunio C Hamano <gitster@pobox.com>2025-10-24 13:42:43 -0700
commit5c2ad50193896dc74e51e4b7a5af4ea734746316 (patch)
tree115507802d550040b5f8fc9e756035e80dd40832 /builtin
parentbuiltin/maintenance: introduce "geometric-repack" task (diff)
downloadgit-5c2ad50193896dc74e51e4b7a5af4ea734746316.tar.gz
git-5c2ad50193896dc74e51e4b7a5af4ea734746316.zip
builtin/maintenance: make the geometric factor configurable
The geometric repacking task uses a factor of two for its geometric sequence, meaning that each next pack must contain at least twice as many objects as the next-smaller one. In some cases it may be helpful to configure this factor though to reduce the number of packfile merges even further, e.g. in very big repositories. But while git-repack(1) itself supports doing this, the maintenance task does not give us a way to tune it. Introduce a new "maintenance.geometric-repack.splitFactor" configuration to plug this gap. Signed-off-by: Patrick Steinhardt <ps@pks.im> Acked-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/gc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index 2c9ecd464d..fb1a82e030 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1582,6 +1582,9 @@ static int maintenance_task_geometric_repack(struct maintenance_run_opts *opts,
struct child_process child = CHILD_PROCESS_INIT;
int ret;
+ repo_config_get_int(the_repository, "maintenance.geometric-repack.splitFactor",
+ &geometry.split_factor);
+
existing_packs.repo = the_repository;
existing_packs_collect(&existing_packs, &kept_packs);
pack_geometry_init(&geometry, &existing_packs, &po_args);
@@ -1591,7 +1594,8 @@ static int maintenance_task_geometric_repack(struct maintenance_run_opts *opts,
strvec_pushl(&child.args, "repack", "-d", "-l", NULL);
if (geometry.split < geometry.pack_nr)
- strvec_push(&child.args, "--geometric=2");
+ strvec_pushf(&child.args, "--geometric=%d",
+ geometry.split_factor);
else
add_repack_all_option(cfg, NULL, &child.args);
if (opts->quiet)
@@ -1632,6 +1636,9 @@ static int geometric_repack_auto_condition(struct gc_config *cfg UNUSED)
if (auto_value < 0)
return 1;
+ repo_config_get_int(the_repository, "maintenance.geometric-repack.splitFactor",
+ &geometry.split_factor);
+
existing_packs.repo = the_repository;
existing_packs_collect(&existing_packs, &kept_packs);
pack_geometry_init(&geometry, &existing_packs, &po_args);