Skip to content

Commit acc1c4d

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Reviewed-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 41abfe1 commit acc1c4d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

Documentation/config/maintenance.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ maintenance.strategy::
1515
* `none`: This default setting implies no task are run at any schedule.
1616
* `incremental`: This setting optimizes for performing small maintenance
1717
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.
2021

2122
maintenance.<task>.enabled::
2223
This boolean config option controls whether the maintenance task

builtin/gc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,8 @@ static void initialize_maintenance_strategy(void)
13521352
tasks[TASK_INCREMENTAL_REPACK].schedule = SCHEDULE_DAILY;
13531353
tasks[TASK_LOOSE_OBJECTS].enabled = 1;
13541354
tasks[TASK_LOOSE_OBJECTS].schedule = SCHEDULE_DAILY;
1355+
tasks[TASK_PACK_REFS].enabled = 1;
1356+
tasks[TASK_PACK_REFS].schedule = SCHEDULE_WEEKLY;
13551357
}
13561358
}
13571359

t/t7900-maintenance.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,18 +408,32 @@ test_expect_success 'maintenance.strategy inheritance' '
408408
git maintenance run --schedule=hourly --quiet &&
409409
GIT_TRACE2_EVENT="$(pwd)/incremental-daily.txt" \
410410
git maintenance run --schedule=daily --quiet &&
411+
GIT_TRACE2_EVENT="$(pwd)/incremental-weekly.txt" \
412+
git maintenance run --schedule=weekly --quiet &&
411413
412414
test_subcommand git commit-graph write --split --reachable \
413415
--no-progress <incremental-hourly.txt &&
414416
test_subcommand ! git prune-packed --quiet <incremental-hourly.txt &&
415417
test_subcommand ! git multi-pack-index write --no-progress \
416418
<incremental-hourly.txt &&
419+
test_subcommand ! git pack-refs --all --prune \
420+
<incremental-hourly.txt &&
417421
418422
test_subcommand git commit-graph write --split --reachable \
419423
--no-progress <incremental-daily.txt &&
420424
test_subcommand git prune-packed --quiet <incremental-daily.txt &&
421425
test_subcommand git multi-pack-index write --no-progress \
422426
<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 &&
423437
424438
# Modify defaults
425439
git config maintenance.commit-graph.schedule daily &&

0 commit comments

Comments
 (0)