maintenance: incremental strategy runs pack-refs weekly

When the 'maintenance.strategy' config option is set to 'incremental', a default maintenance schedule is enabled. Add the 'pack-refs' task to that strategy at the weekly cadence. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Feb 9, 2021 at 13:42 UTC acc1c4d5d4c80c4fd93aaa151caa5593656600ae
3 files changed +19 -2
Documentation/config/maintenance.txt
+3 -2
@@ -15,8 +15,9 @@ maintenance.strategy::
15 * `none`: This default setting implies no task are run at any schedule.
16 * `incremental`: This setting optimizes for performing small maintenance
17 activities that do not delete any data. This does not schedule the `gc`
18 - task, but runs the `prefetch` and `commit-graph` tasks hourly and the
19 - `loose-objects` and `incremental-repack` tasks daily.
18 + task, but runs the `prefetch` and `commit-graph` tasks hourly, the
19 + `loose-objects` and `incremental-repack` tasks daily, and the `pack-refs`
20 + task weekly.
21
22 maintenance.<task>.enabled::
23 This boolean config option controls whether the maintenance task
builtin/gc.c
+2
@@ -1352,6 +1352,8 @@ static void initialize_maintenance_strategy(void)
1352 tasks[TASK_INCREMENTAL_REPACK].schedule = SCHEDULE_DAILY;
1353 tasks[TASK_LOOSE_OBJECTS].enabled = 1;
1354 tasks[TASK_LOOSE_OBJECTS].schedule = SCHEDULE_DAILY;
1355 + tasks[TASK_PACK_REFS].enabled = 1;
1356 + tasks[TASK_PACK_REFS].schedule = SCHEDULE_WEEKLY;
1357 }
1358 }
1359
t/t7900-maintenance.sh
+14
@@ -408,18 +408,32 @@ test_expect_success 'maintenance.strategy inheritance' '
408 git maintenance run --schedule=hourly --quiet &&
409 GIT_TRACE2_EVENT="$(pwd)/incremental-daily.txt" \
410 git maintenance run --schedule=daily --quiet &&
411 + GIT_TRACE2_EVENT="$(pwd)/incremental-weekly.txt" \
412 + git maintenance run --schedule=weekly --quiet &&
413
414 test_subcommand git commit-graph write --split --reachable \
415 --no-progress <incremental-hourly.txt &&
416 test_subcommand ! git prune-packed --quiet <incremental-hourly.txt &&
417 test_subcommand ! git multi-pack-index write --no-progress \
418 <incremental-hourly.txt &&
419 + test_subcommand ! git pack-refs --all --prune \
420 + <incremental-hourly.txt &&
421
422 test_subcommand git commit-graph write --split --reachable \
423 --no-progress <incremental-daily.txt &&
424 test_subcommand git prune-packed --quiet <incremental-daily.txt &&
425 test_subcommand git multi-pack-index write --no-progress \
426 <incremental-daily.txt &&
427 + test_subcommand ! git pack-refs --all --prune \
428 + <incremental-daily.txt &&
429 +
430 + test_subcommand git commit-graph write --split --reachable \
431 + --no-progress <incremental-weekly.txt &&
432 + test_subcommand git prune-packed --quiet <incremental-weekly.txt &&
433 + test_subcommand git multi-pack-index write --no-progress \
434 + <incremental-weekly.txt &&
435 + test_subcommand git pack-refs --all --prune \
436 + <incremental-weekly.txt &&
437
438 # Modify defaults
439 git config maintenance.commit-graph.schedule daily &&