]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7900: prepare for switch of the default strategy
authorPatrick Steinhardt <ps@pks.im>
Tue, 24 Feb 2026 08:45:51 +0000 (09:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Feb 2026 15:33:20 +0000 (07:33 -0800)
The t7900 test suite is exercising git-maintenance(1) and is thus of
course heavily reliant on the exact maintenance strategy. This reliance
comes in two flavors:

  - One test explicitly wants to verify that git-gc(1) is run as part of
    `git maintenance run`. This test is adapted by explicitly picking the
    "gc" strategy.

  - The other tests assume a specific shape of the object database,
    which is dependent on whether or not we run auto-maintenance before
    we come to the actual subject under test. These tests are adapted by
    disabling auto-maintenance.

With these changes t7900 passes with both "gc" and "geometric" default
strategies.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7900-maintenance.sh

index fe344f47ee5c89a8586ed6393d4624dc5d935cbf..4700beacc18281413fc8d88ff35ea6ce392b0208 100755 (executable)
@@ -45,7 +45,8 @@ test_expect_success 'help text' '
        test_grep "usage: git maintenance" err
 '
 
-test_expect_success 'run [--auto|--quiet]' '
+test_expect_success 'run [--auto|--quiet] with gc strategy' '
+       test_config maintenance.strategy gc &&
        GIT_TRACE2_EVENT="$(pwd)/run-no-auto.txt" \
                git maintenance run 2>/dev/null &&
        GIT_TRACE2_EVENT="$(pwd)/run-auto.txt" \
@@ -499,6 +500,7 @@ test_expect_success 'maintenance.incremental-repack.auto' '
        (
                cd incremental-repack-true &&
                git config core.multiPackIndex true &&
+               git config maintenance.auto false &&
                run_incremental_repack_and_verify
        )
 '
@@ -509,6 +511,7 @@ test_expect_success 'maintenance.incremental-repack.auto (when config is unset)'
        (
                cd incremental-repack-unset &&
                test_unconfig core.multiPackIndex &&
+               git config maintenance.auto false &&
                run_incremental_repack_and_verify
        )
 '
@@ -619,6 +622,7 @@ test_expect_success 'geometric repacking with --auto' '
        git init repo &&
        (
                cd repo &&
+               git config set maintenance.auto false &&
 
                # An empty repository does not need repacking, except when
                # explicitly told to do it.