[PATCH 5/6] bitmap-commit-table: add tests for the bitmap lookup table
From: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>
Add tests to check the working of the newly implemented lookup table.
Mentored-by: Taylor Blau <ttaylorr@github.com>
Co-Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>
---
t/t5310-pack-bitmaps.sh | 14 ++++++++++++++
t/t5326-multi-pack-bitmaps.sh | 19 +++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index f775fc1ce69..f05d3e6ace7 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -43,6 +43,20 @@ test_expect_success 'full repack creates bitmaps' '
basic_bitmap_tests
+test_expect_success 'using lookup table does not affect basic bitmap tests' '
+ test_config pack.writeBitmapLookupTable true &&
+ git repack -adb
+'
+basic_bitmap_tests
+
+test_expect_success 'using lookup table does not let each entries to be parsed one by one' '
+ test_config pack.writeBitmapLookupTable true &&
+ git repack -adb &&
+ git rev-list --test-bitmap HEAD 2>out &&
+ grep "Found bitmap for" out &&
+ ! grep "Bitmap v1 test "
+'
+
test_expect_success 'incremental repack fails when bitmaps are requested' '
test_commit more-1 &&
test_must_fail git repack -d 2>err &&
diff --git a/t/t5326-multi-pack-bitmaps.sh b/t/t5326-multi-pack-bitmaps.sh
index 4fe57414c13..85fbdf5e4bb 100755
--- a/t/t5326-multi-pack-bitmaps.sh
+++ b/t/t5326-multi-pack-bitmaps.sh
@@ -306,5 +306,24 @@ test_expect_success 'graceful fallback when missing reverse index' '
! grep "ignoring extra bitmap file" err
)
'
+test_expect_success 'multi-pack-index write --bitmap writes lookup table if enabled' '
+ rm -fr repo &&
+ git init repo &&
+ test_when_finished "rm -fr repo" &&
+ (
+ cd repo &&
+ test_commit_bulk 106 &&
+
+ git repack -d &&
+
+ git config pack.writeBitmapLookupTable true &&
+ git multi-pack-index write --bitmap &&
+
+ git rev-list --test-bitmap HEAD 2>out &&
+ grep "Found bitmap for" out &&
+ ! grep "Bitmap v1 test "
+
+ )
+'
test_done
--
gitgitgadget