1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-25 04:16:09 +02:00

fsck: verify multi-pack-index when implictly enabled

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>
This commit is contained in:
Glen Choo 2021-10-15 13:16:30 -07:00 committed by Junio C Hamano
parent f30e4d854b
commit dc5570872f
2 changed files with 5 additions and 2 deletions

View 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 };

View File

@ -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' '