summaryrefslogtreecommitdiff
path: root/t/t5310-pack-bitmaps.sh
diff options
context:
space:
mode:
authorAbhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>2022-08-14 16:55:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-08-26 17:13:58 (GMT)
commit28cd730680dd7d5c0e0971827315bf8ae32f47b7 (patch)
treeb1a204d17a3affe9dddaf0801c636fc0737f2329 /t/t5310-pack-bitmaps.sh
parent76f14b777c13ac8d8f6a2e5812945e725bea3d84 (diff)
downloadgit-28cd730680dd7d5c0e0971827315bf8ae32f47b7.zip
git-28cd730680dd7d5c0e0971827315bf8ae32f47b7.tar.gz
git-28cd730680dd7d5c0e0971827315bf8ae32f47b7.tar.bz2
pack-bitmap: prepare to read lookup table extension
Earlier change teaches Git to write bitmap lookup table. But Git does not know how to parse them. Teach Git to parse the existing bitmap lookup table. The older versions of Git are not affected by it. Those versions ignore the lookup table. Mentored-by: Taylor Blau <me@ttaylorr.com> Co-Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Signed-off-by: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5310-pack-bitmaps.sh')
-rwxr-xr-xt/t5310-pack-bitmaps.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index c060717..7e50f8e 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -258,6 +258,7 @@ test_bitmap_cases () {
test_expect_success 'truncated bitmap fails gracefully (ewah)' '
test_config pack.writebitmaphashcache false &&
+ test_config pack.writebitmaplookuptable false &&
git repack -ad &&
git rev-list --use-bitmap-index --count --all >expect &&
bitmap=$(ls .git/objects/pack/*.bitmap) &&
@@ -270,6 +271,7 @@ test_bitmap_cases () {
'
test_expect_success 'truncated bitmap fails gracefully (cache)' '
+ git config pack.writeBitmapLookupTable '"$writeLookupTable"' &&
git repack -ad &&
git rev-list --use-bitmap-index --count --all >expect &&
bitmap=$(ls .git/objects/pack/*.bitmap) &&
@@ -453,4 +455,24 @@ test_expect_success 'verify writing bitmap lookup table when enabled' '
grep "\"label\":\"writing_lookup_table\"" trace2
'
+test_expect_success 'lookup table is actually used to traverse objects' '
+ git repack -adb &&
+ GIT_TRACE2_EVENT="$(pwd)/trace3" \
+ git rev-list --use-bitmap-index --count --all &&
+ grep "\"label\":\"reading_lookup_table\"" trace3
+'
+
+test_expect_success 'truncated bitmap fails gracefully (lookup table)' '
+ test_config pack.writebitmaphashcache false &&
+ git repack -adb &&
+ git rev-list --use-bitmap-index --count --all >expect &&
+ bitmap=$(ls .git/objects/pack/*.bitmap) &&
+ test_when_finished "rm -f $bitmap" &&
+ test_copy_bytes 512 <$bitmap >$bitmap.tmp &&
+ mv -f $bitmap.tmp $bitmap &&
+ git rev-list --use-bitmap-index --count --all >actual 2>stderr &&
+ test_cmp expect actual &&
+ test_i18ngrep corrupted.bitmap.index stderr
+'
+
test_done