Skip to content

Commit 3ed388f

Browse files
committed
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 <[email protected]>
1 parent 8e24393 commit 3ed388f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

t/t5319-multi-pack-index.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,5 +527,24 @@ test_expect_success 'expire respects .keep files' '
527527
)
528528
'
529529

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+
'
530549

531550
test_done

0 commit comments

Comments
 (0)