diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-10-24 08:57:17 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-10-24 13:42:43 -0700 |
| commit | 5c2ad50193896dc74e51e4b7a5af4ea734746316 (patch) | |
| tree | 115507802d550040b5f8fc9e756035e80dd40832 /t | |
| parent | builtin/maintenance: introduce "geometric-repack" task (diff) | |
| download | git-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 't')
| -rwxr-xr-x | t/t7900-maintenance.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index ace0ba8300..e0352fd196 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -603,6 +603,38 @@ test_expect_success 'geometric repacking with --auto' ' ) ' +test_expect_success 'geometric repacking honors configured split factor' ' + test_when_finished "rm -rf repo" && + git init repo && + ( + cd repo && + git config set maintenance.auto false && + + # Create three different packs with 9, 2 and 1 object, respectively. + # This is done so that only a subset of packs would be merged + # together so that we can verify that `git repack` receives the + # correct geometric factor. + for i in $(test_seq 9) + do + echo first-$i | git hash-object -w --stdin -t blob || return 1 + done && + git repack --geometric=2 -d && + + for i in $(test_seq 2) + do + echo second-$i | git hash-object -w --stdin -t blob || return 1 + done && + git repack --geometric=2 -d && + + echo third | git hash-object -w --stdin -t blob && + git repack --geometric=2 -d && + + test_geometric_repack_needed false splitFactor=2 && + test_geometric_repack_needed true splitFactor=3 && + test_subcommand git repack -d -l --geometric=3 --quiet --write-midx <trace2.txt + ) +' + test_expect_success 'pack-refs task' ' for n in $(test_seq 1 5) do |
