Skip to content

Commit dc55708

Browse files
chooglengitster
authored andcommitted
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 18e449f (midx: enable core.multiPackIndex by default, 2020-09-25) where core.multiPackIndex was turned on by default. Helped-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Glen Choo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f30e4d8 commit dc55708

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

builtin/fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
925925
}
926926
}
927927

928-
if (!git_config_get_bool("core.multipackindex", &i) && i) {
928+
if (the_repository->settings.core_multi_pack_index) {
929929
struct child_process midx_verify = CHILD_PROCESS_INIT;
930930
const char *midx_argv[] = { "multi-pack-index", "verify", NULL, NULL, NULL };
931931

t/t5319-multi-pack-index.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,10 @@ test_expect_success 'verify incorrect offset' '
452452
test_expect_success 'git-fsck incorrect offset' '
453453
corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\377" $objdir \
454454
"incorrect object offset" \
455-
"git -c core.multipackindex=true fsck"
455+
"git -c core.multiPackIndex=true fsck" &&
456+
test_unconfig core.multiPackIndex &&
457+
test_must_fail git fsck &&
458+
git -c core.multiPackIndex=false fsck
456459
'
457460

458461
test_expect_success 'corrupt MIDX is not reused' '

0 commit comments

Comments
 (0)