зеркало из https://github.com/microsoft/git.git
t5326: demonstrate bitmap corruption after permutation
This patch demonstrates a cause of bitmap corruption that can occur when the contents of the multi-pack index does not change, but the underlying object order does. In this example, we have a MIDX containing two packs, each with a distinct set of objects (pack A corresponds to the tree, blob, and commit from the first patch, and pack B corresponds to the second patch). First, a MIDX is written where the 'A' pack is preferred. As expected, the bitmaps generated there are in-tact. But then, we generate an identical MIDX with a different object order: this time preferring pack 'B'. Due to a bug which will be explained and fixed in the following commit, the MIDX is updated, but the .rev file is not, causing the .bitmap file to be read incorrectly. Specifically, the .bitmap file will contain correct data, but the auxiliary object order in the .rev file is stale, causing readers to get confused by reading the new bitmaps using the old object order. Signed-off-by: Taylor Blau <me@ttaylorr.com> Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
dcc0cd074f
Коммит
61fd31a179
|
@ -395,4 +395,35 @@ test_expect_success 'hash-cache values are propagated from pack bitmaps' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_failure 'changing the preferred pack does not corrupt bitmaps' '
|
||||
rm -fr repo &&
|
||||
git init repo &&
|
||||
test_when_finished "rm -fr repo" &&
|
||||
(
|
||||
cd repo &&
|
||||
|
||||
test_commit A &&
|
||||
test_commit B &&
|
||||
|
||||
git rev-list --objects --no-object-names HEAD^ >A.objects &&
|
||||
git rev-list --objects --no-object-names HEAD^.. >B.objects &&
|
||||
|
||||
A=$(git pack-objects $objdir/pack/pack <A.objects) &&
|
||||
B=$(git pack-objects $objdir/pack/pack <B.objects) &&
|
||||
|
||||
cat >indexes <<-EOF &&
|
||||
pack-$A.idx
|
||||
pack-$B.idx
|
||||
EOF
|
||||
|
||||
git multi-pack-index write --bitmap --stdin-packs \
|
||||
--preferred-pack=pack-$A.pack <indexes &&
|
||||
git rev-list --test-bitmap A &&
|
||||
|
||||
git multi-pack-index write --bitmap --stdin-packs \
|
||||
--preferred-pack=pack-$B.pack <indexes &&
|
||||
git rev-list --test-bitmap A
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче