]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5319-multi-pack-index.sh
upload-pack: move allow_unadvertised_object_request to upload_pack_data
[thirdparty/git.git] / t / t5319-multi-pack-index.sh
index 030a7222b2aca5e97652194ea9a0d8cdf4ca9ab0..7214cab36c0f74ef4c731a189b2490c14a2fa6e4 100755 (executable)
@@ -538,6 +538,33 @@ test_expect_success 'repack with minimum size does not alter existing packs' '
        )
 '
 
+test_expect_success 'repack respects repack.packKeptObjects=false' '
+       test_when_finished rm -f dup/.git/objects/pack/*keep &&
+       (
+               cd dup &&
+               ls .git/objects/pack/*idx >idx-list &&
+               test_line_count = 5 idx-list &&
+               ls .git/objects/pack/*.pack | sed "s/\.pack/.keep/" >keep-list &&
+               test_line_count = 5 keep-list &&
+               for keep in $(cat keep-list)
+               do
+                       touch $keep || return 1
+               done &&
+               git multi-pack-index repack --batch-size=0 &&
+               ls .git/objects/pack/*idx >idx-list &&
+               test_line_count = 5 idx-list &&
+               test-tool read-midx .git/objects | grep idx >midx-list &&
+               test_line_count = 5 midx-list &&
+               THIRD_SMALLEST_SIZE=$(test-tool path-utils file-size .git/objects/pack/*pack | sort -n | sed -n 3p) &&
+               BATCH_SIZE=$((THIRD_SMALLEST_SIZE + 1)) &&
+               git multi-pack-index repack --batch-size=$BATCH_SIZE &&
+               ls .git/objects/pack/*idx >idx-list &&
+               test_line_count = 5 idx-list &&
+               test-tool read-midx .git/objects | grep idx >midx-list &&
+               test_line_count = 5 midx-list
+       )
+'
+
 test_expect_success 'repack creates a new pack' '
        (
                cd dup &&