]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5319-multi-pack-index.sh: test batch size zero
authorDerrick Stolee <dstolee@microsoft.com>
Mon, 10 Jun 2019 23:35:29 +0000 (16:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Jun 2019 17:34:41 +0000 (10:34 -0700)
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>
t/t5319-multi-pack-index.sh

index c2889014010bc6a7b12b1f33a7769e7f1b0c59f4..79bfaeafa9b172ecf22e6cb4143edae9d7fcde1f 100755 (executable)
@@ -527,5 +527,24 @@ test_expect_success 'expire respects .keep files' '
        )
 '
 
+test_expect_success 'repack --batch-size=0 repacks everything' '
+       (
+               cd dup &&
+               rm .git/objects/pack/*.keep &&
+               ls .git/objects/pack/*idx >idx-list &&
+               test_line_count = 2 idx-list &&
+               git multi-pack-index repack --batch-size=0 &&
+               ls .git/objects/pack/*idx >idx-list &&
+               test_line_count = 3 idx-list &&
+               test-tool read-midx .git/objects | grep idx >midx-list &&
+               test_line_count = 3 midx-list &&
+               git multi-pack-index expire &&
+               ls -al .git/objects/pack/*idx >idx-list &&
+               test_line_count = 1 idx-list &&
+               git multi-pack-index repack --batch-size=0 &&
+               ls -al .git/objects/pack/*idx >new-idx-list &&
+               test_cmp idx-list new-idx-list
+       )
+'
 
 test_done