]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck: verify multi-pack-index when implictly enabled
authorGlen Choo <chooglen@google.com>
Fri, 15 Oct 2021 20:16:30 +0000 (13:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Oct 2021 21:30:08 +0000 (14:30 -0700)
Like the previous commit, change fsck to check the
"core_multi_pack_index" variable set in "repo-settings.c" instead of
reading the "core.multiPackIndex" config variable. This fixes a bug
where we wouldn't verify midx if the config key was missing. This bug
was introduced in 18e449f86b (midx: enable core.multiPackIndex by
default, 2020-09-25) where core.multiPackIndex was turned on by default.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c
t/t5319-multi-pack-index.sh

index 1c4e485b66dc3cf862599989fd8f0d73b28fc9d8..5bbe8068ecc278edaad0f381aac22c34a275deb9 100644 (file)
@@ -925,7 +925,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
                }
        }
 
-       if (!git_config_get_bool("core.multipackindex", &i) && i) {
+       if (the_repository->settings.core_multi_pack_index) {
                struct child_process midx_verify = CHILD_PROCESS_INIT;
                const char *midx_argv[] = { "multi-pack-index", "verify", NULL, NULL, NULL };
 
index bd17f308b3832897747bc7ee9f2cf47943cb2e88..38999f115f3382a5aa2b58a730caa0d039c60356 100755 (executable)
@@ -452,7 +452,10 @@ test_expect_success 'verify incorrect offset' '
 test_expect_success 'git-fsck incorrect offset' '
        corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\377" $objdir \
                "incorrect object offset" \
-               "git -c core.multipackindex=true fsck"
+               "git -c core.multiPackIndex=true fsck" &&
+       test_unconfig core.multiPackIndex &&
+       test_must_fail git fsck &&
+       git -c core.multiPackIndex=false fsck
 '
 
 test_expect_success 'corrupt MIDX is not reused' '