apply --recount: allow "no-op hunks"
[gitweb.git] / t / t5310-pack-bitmaps.sh
index 2d22a17c4a7f9dcc402e89e73ce01c97ebd4ba48..7bff7923f2a91165b5a0b5251351798519d63270 100755 (executable)
@@ -9,7 +9,8 @@ objpath () {
 
 # show objects present in pack ($1 should be associated *.idx)
 list_packed_objects () {
-       git show-index <"$1" | cut -d' ' -f2
+       git show-index <"$1" >object-list &&
+       cut -d' ' -f2 object-list
 }
 
 # has_any pattern-file content-file
@@ -204,8 +205,8 @@ test_expect_success 'pack-objects to file can use bitmap' '
        # verify equivalent packs are generated with/without using bitmap index
        packasha1=$(git pack-objects --no-use-bitmap-index --all packa </dev/null) &&
        packbsha1=$(git pack-objects --use-bitmap-index --all packb </dev/null) &&
-       list_packed_objects <packa-$packasha1.idx >packa.objects &&
-       list_packed_objects <packb-$packbsha1.idx >packb.objects &&
+       list_packed_objects packa-$packasha1.idx >packa.objects &&
+       list_packed_objects packb-$packbsha1.idx >packb.objects &&
        test_cmp packa.objects packb.objects
 '
 
@@ -309,9 +310,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,17 +319,15 @@ 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' '
@@ -337,7 +335,7 @@ test_expect_success 'truncated bitmap fails gracefully' '
        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 &&
+       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 &&