]> git.ipfire.org Git - thirdparty/git.git/commitdiff
maintenance: incremental strategy runs pack-refs weekly
authorDerrick Stolee <dstolee@microsoft.com>
Tue, 9 Feb 2021 13:42:29 +0000 (13:42 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Feb 2021 07:09:29 +0000 (23:09 -0800)
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>
Documentation/config/maintenance.txt
builtin/gc.c
t/t7900-maintenance.sh

index a5ead09e4bc2d1ca8834b332322315bcc72f352c..18f056213145e595d0a57792e716f29521122997 100644 (file)
@@ -15,8 +15,9 @@ maintenance.strategy::
 * `none`: This default setting implies no task are run at any schedule.
 * `incremental`: This setting optimizes for performing small maintenance
   activities that do not delete any data. This does not schedule the `gc`
-  task, but runs the `prefetch` and `commit-graph` tasks hourly and the
-  `loose-objects` and `incremental-repack` tasks daily.
+  task, but runs the `prefetch` and `commit-graph` tasks hourly, the
+  `loose-objects` and `incremental-repack` tasks daily, and the `pack-refs`
+  task weekly.
 
 maintenance.<task>.enabled::
        This boolean config option controls whether the maintenance task
index 41bec4f177b3376114e97507f07375004d1bd6a0..6db9cb39e6797f9f3bea580916ec4e855e32cea3 100644 (file)
@@ -1352,6 +1352,8 @@ static void initialize_maintenance_strategy(void)
                tasks[TASK_INCREMENTAL_REPACK].schedule = SCHEDULE_DAILY;
                tasks[TASK_LOOSE_OBJECTS].enabled = 1;
                tasks[TASK_LOOSE_OBJECTS].schedule = SCHEDULE_DAILY;
+               tasks[TASK_PACK_REFS].enabled = 1;
+               tasks[TASK_PACK_REFS].schedule = SCHEDULE_WEEKLY;
        }
 }
 
index 4a8a78769bd648f43b8617b7b62a9b3e4f6f7703..286b18db3cc2d59e000f897d4a9fa3ad7ae46af7 100755 (executable)
@@ -408,18 +408,32 @@ test_expect_success 'maintenance.strategy inheritance' '
                git maintenance run --schedule=hourly --quiet &&
        GIT_TRACE2_EVENT="$(pwd)/incremental-daily.txt" \
                git maintenance run --schedule=daily --quiet &&
+       GIT_TRACE2_EVENT="$(pwd)/incremental-weekly.txt" \
+               git maintenance run --schedule=weekly --quiet &&
 
        test_subcommand git commit-graph write --split --reachable \
                --no-progress <incremental-hourly.txt &&
        test_subcommand ! git prune-packed --quiet <incremental-hourly.txt &&
        test_subcommand ! git multi-pack-index write --no-progress \
                <incremental-hourly.txt &&
+       test_subcommand ! git pack-refs --all --prune \
+               <incremental-hourly.txt &&
 
        test_subcommand git commit-graph write --split --reachable \
                --no-progress <incremental-daily.txt &&
        test_subcommand git prune-packed --quiet <incremental-daily.txt &&
        test_subcommand git multi-pack-index write --no-progress \
                <incremental-daily.txt &&
+       test_subcommand ! git pack-refs --all --prune \
+               <incremental-daily.txt &&
+
+       test_subcommand git commit-graph write --split --reachable \
+               --no-progress <incremental-weekly.txt &&
+       test_subcommand git prune-packed --quiet <incremental-weekly.txt &&
+       test_subcommand git multi-pack-index write --no-progress \
+               <incremental-weekly.txt &&
+       test_subcommand git pack-refs --all --prune \
+               <incremental-weekly.txt &&
 
        # Modify defaults
        git config maintenance.commit-graph.schedule daily &&