Merge branch 'tb/idx-midx-race-fix'
Processes that access packdata while the .idx file gets removed (e.g. while repacking) did not fail or fall back gracefully as they could. * tb/idx-midx-race-fix: midx.c: protect against disappearing packs packfile.c: protect against disappearing indexes
This commit is contained in:
@ -138,7 +138,7 @@ test_expect_success 'write midx with one v2 pack' '
|
||||
|
||||
compare_results_with_midx "one v2 pack"
|
||||
|
||||
test_expect_success 'corrupt idx not opened' '
|
||||
test_expect_success 'corrupt idx reports errors' '
|
||||
idx=$(test-tool read-midx $objdir | grep "\.idx\$") &&
|
||||
mv $objdir/pack/$idx backup-$idx &&
|
||||
test_when_finished "mv backup-\$idx \$objdir/pack/\$idx" &&
|
||||
@ -149,7 +149,7 @@ test_expect_success 'corrupt idx not opened' '
|
||||
test_copy_bytes 1064 <backup-$idx >$objdir/pack/$idx &&
|
||||
|
||||
git -c core.multiPackIndex=true rev-list --objects --all 2>err &&
|
||||
test_must_be_empty err
|
||||
grep "index unavailable" err
|
||||
'
|
||||
|
||||
test_expect_success 'add more objects' '
|
||||
@ -755,4 +755,30 @@ test_expect_success 'repack --batch-size=<large> repacks everything' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'load reverse index when missing .idx, .pack' '
|
||||
git init repo &&
|
||||
test_when_finished "rm -fr repo" &&
|
||||
(
|
||||
cd repo &&
|
||||
|
||||
git config core.multiPackIndex true &&
|
||||
|
||||
test_commit base &&
|
||||
git repack -ad &&
|
||||
git multi-pack-index write &&
|
||||
|
||||
git rev-parse HEAD >tip &&
|
||||
pack=$(ls .git/objects/pack/pack-*.pack) &&
|
||||
idx=$(ls .git/objects/pack/pack-*.idx) &&
|
||||
|
||||
mv $idx $idx.bak &&
|
||||
git cat-file --batch-check="%(objectsize:disk)" <tip &&
|
||||
|
||||
mv $idx.bak $idx &&
|
||||
|
||||
mv $pack $pack.bak &&
|
||||
git cat-file --batch-check="%(objectsize:disk)" <tip
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user