tests: use 'test_must_be_empty' instead of 'test ! -s'
[gitweb.git] / t / t5310-pack-bitmaps.sh
index 423c0a475f7e87b4c32abf60ef85ccbb898eca11..6ee4d3f2d91f435ad29010b16523ea4417dc625d 100755 (executable)
@@ -309,9 +309,8 @@ test_expect_success 'pack reuse respects --honor-pack-keep' '
        done &&
        reusable_pack --honor-pack-keep >empty.pack &&
        git index-pack empty.pack &&
-       >expect &&
        git show-index <empty.idx >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
 '
 
 test_expect_success 'pack reuse respects --local' '
@@ -319,16 +318,27 @@ test_expect_success 'pack reuse respects --local' '
        test_when_finished "mv alt.git/objects/pack/* .git/objects/pack/" &&
        reusable_pack --local >empty.pack &&
        git index-pack empty.pack &&
-       >expect &&
        git show-index <empty.idx >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
 '
 
 test_expect_success 'pack reuse respects --incremental' '
        reusable_pack --incremental >empty.pack &&
        git index-pack empty.pack &&
-       >expect &&
        git show-index <empty.idx >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
 '
+
+test_expect_success 'truncated bitmap fails gracefully' '
+       git repack -ad &&
+       git rev-list --use-bitmap-index --count --all >expect &&
+       bitmap=$(ls .git/objects/pack/*.bitmap) &&
+       test_when_finished "rm -f $bitmap" &&
+       head -c 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 corrupt stderr
+'
+
 test_done