3 test_description
='multi-pack-indexes'
11 header: 4d494458 1 3 $NUM_PACKS
12 chunks: pack-names oid-fanout oid-lookup
13 num_objects: $NUM_OBJECTS
16 if test $NUM_PACKS -ge 1
18 ls pack
/ |
grep idx |
sort
20 printf "object-dir: .\n"
22 test-tool read-midx .
>actual
&&
23 test_cmp expect actual
26 test_expect_success
'write midx with no packs' '
27 test_when_finished rm -f pack/multi-pack-index &&
28 git multi-pack-index --object-dir=. write &&
34 iii
=$
(printf '%03i' $i)
36 test-tool genrandom
"bar" 200 &&
37 test-tool genrandom
"baz $iii" 50
40 test-tool genrandom
"foo"$i 100 &&
41 test-tool genrandom
"foo"$
(( $i + 1 )) 100 &&
42 test-tool genrandom
"foo"$
(( $i + 2 )) 100
46 test-tool genrandom
"$iii" 8192
48 git update-index
--add file_
$iii deep_delta_
$iii wide_delta_
$iii
51 commit_and_list_objects
() {
54 test-tool genrandom
100 8192;
56 git update-index
--add file_101
&&
57 tree
=$
(git write-tree
) &&
58 commit
=$
(git commit-tree
$tree -p HEAD
</dev
/null
) &&
61 git ls-tree
$tree |
sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
63 git
reset --hard $commit
66 test_expect_success
'create objects' '
67 test_commit initial &&
68 for i in $(test_seq 1 5)
72 commit_and_list_objects
75 test_expect_success
'write midx with one v1 pack' '
76 pack=$(git pack-objects --index-version=1 pack/test <obj-list) &&
77 test_when_finished rm pack/test-$pack.pack pack/test-$pack.idx pack/multi-pack-index &&
78 git multi-pack-index --object-dir=. write &&
82 test_expect_success
'write midx with one v2 pack' '
83 git pack-objects --index-version=2,0x40 pack/test <obj-list &&
84 git multi-pack-index --object-dir=. write &&
88 test_expect_success
'add more objects' '
89 for i in $(test_seq 6 10)
93 commit_and_list_objects
96 test_expect_success
'write midx with two packs' '
97 git pack-objects --index-version=1 pack/test-2 <obj-list &&
98 git multi-pack-index --object-dir=. write &&
102 test_expect_success
'add more packs' '
103 for j in $(test_seq 11 20)
105 generate_objects $j &&
106 commit_and_list_objects &&
107 git pack-objects --index-version=2 pack/test-pack <obj-list
111 test_expect_success
'write midx with twelve packs' '
112 git multi-pack-index --object-dir=. write &&
113 midx_read_expect 12 74