t5319-multi-pack-index.sh: test batch size zero

The 'git multi-pack-index repack' command can take a batch size of zero, which creates a new pack-file containing all objects in the multi-pack-index. The first 'repack' command will create one new pack-file, and an 'expire' command after that will delete the old pack-files, as they no longer contain any referenced objects in the multi-pack-index. We must remove the .keep file that was added in the previous test in order to expire that pack-file. Also test that a 'repack' will do nothing if there is only one pack-file. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Jun 10, 2019 at 16:35 UTC b526d8cbbb8740faa10411caa757c6586395fcab
1 file changed +19
t/t5319-multi-pack-index.sh
+19
@@ -527,5 +527,24 @@ test_expect_success 'expire respects .keep files' '
527 )
528 '
529
530 +test_expect_success 'repack --batch-size=0 repacks everything' '
531 + (
532 + cd dup &&
533 + rm .git/objects/pack/*.keep &&
534 + ls .git/objects/pack/*idx >idx-list &&
535 + test_line_count = 2 idx-list &&
536 + git multi-pack-index repack --batch-size=0 &&
537 + ls .git/objects/pack/*idx >idx-list &&
538 + test_line_count = 3 idx-list &&
539 + test-tool read-midx .git/objects | grep idx >midx-list &&
540 + test_line_count = 3 midx-list &&
541 + git multi-pack-index expire &&
542 + ls -al .git/objects/pack/*idx >idx-list &&
543 + test_line_count = 1 idx-list &&
544 + git multi-pack-index repack --batch-size=0 &&
545 + ls -al .git/objects/pack/*idx >new-idx-list &&
546 + test_cmp idx-list new-idx-list
547 + )
548 +'
549
550 test_done