From 40a74158337f9154d26f82aa7923ca281ae131c2 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 24 Oct 2025 08:57:22 +0200 Subject: builtin/maintenance: make "gc" strategy accessible While the user can pick the "incremental" maintenance strategy, it is not possible to explicitly use the "gc" strategy. This has two downsides: - It is impossible to use the default "gc" strategy for a specific repository when the strategy was globally set to a different strategy. - It is not possible to use git-gc(1) for scheduled maintenance. Address these issues by making making the "gc" strategy configurable. Furthermore, extend the strategy so that git-gc(1) runs for both manual and scheduled maintenance. Signed-off-by: Patrick Steinhardt Acked-by: Taylor Blau Signed-off-by: Junio C Hamano --- t/t7900-maintenance.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 5219bc17a6..85e0cea4d9 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -915,7 +915,7 @@ test_expect_success 'maintenance.strategy is respected' ' git gc --quiet --no-detach --skip-foreground-tasks EOF - test_strategy incremental --schedule=weekly <<-\EOF + test_strategy incremental --schedule=weekly <<-\EOF && git pack-refs --all --prune git prune-packed --quiet git multi-pack-index write --no-progress @@ -923,6 +923,18 @@ test_expect_success 'maintenance.strategy is respected' ' git multi-pack-index repack --no-progress --batch-size=1 git commit-graph write --split --reachable --no-progress EOF + + test_strategy gc <<-\EOF && + git pack-refs --all --prune + git reflog expire --all + git gc --quiet --no-detach --skip-foreground-tasks + EOF + + test_strategy gc --schedule=weekly <<-\EOF + git pack-refs --all --prune + git reflog expire --all + git gc --quiet --no-detach --skip-foreground-tasks + EOF ) ' -- cgit v1.3-6-g1900