3 test_description='multi-pack-indexes'
10 header: 4d494458 1 1 $NUM_PACKS
14 if test $NUM_PACKS -ge 1
16 ls pack/ | grep idx | sort
18 printf "object-dir: .\n"
20 test-tool read-midx . >actual &&
21 test_cmp expect actual
24 test_expect_success 'write midx with no packs' '
25 test_when_finished rm -f pack/multi-pack-index &&
26 git multi-pack-index --object-dir=. write &&
32 iii=$(printf '%03i' $i)
34 test-tool genrandom "bar" 200 &&
35 test-tool genrandom "baz $iii" 50
38 test-tool genrandom "foo"$i 100 &&
39 test-tool genrandom "foo"$(( $i + 1 )) 100 &&
40 test-tool genrandom "foo"$(( $i + 2 )) 100
44 test-tool genrandom "$iii" 8192
46 git update-index --add file_$iii deep_delta_$iii wide_delta_$iii
49 commit_and_list_objects () {
52 test-tool genrandom 100 8192;
54 git update-index --add file_101 &&
55 tree=$(git write-tree) &&
56 commit=$(git commit-tree $tree -p HEAD</dev/null) &&
59 git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
61 git reset --hard $commit
64 test_expect_success 'create objects' '
65 test_commit initial &&
66 for i in $(test_seq 1 5)
70 commit_and_list_objects
73 test_expect_success 'write midx with one v1 pack' '
74 pack=$(git pack-objects --index-version=1 pack/test <obj-list) &&
75 test_when_finished rm pack/test-$pack.pack pack/test-$pack.idx pack/multi-pack-index &&
76 git multi-pack-index --object-dir=. write &&
80 test_expect_success 'write midx with one v2 pack' '
81 git pack-objects --index-version=2,0x40 pack/test <obj-list &&
82 git multi-pack-index --object-dir=. write &&
86 test_expect_success 'add more objects' '
87 for i in $(test_seq 6 10)
91 commit_and_list_objects
94 test_expect_success 'write midx with two packs' '
95 git pack-objects --index-version=1 pack/test-2 <obj-list &&
96 git multi-pack-index --object-dir=. write &&
100 test_expect_success 'add more packs' '
101 for j in $(test_seq 11 20)
103 generate_objects $j &&
104 commit_and_list_objects &&
105 git pack-objects --index-version=2 pack/test-pack <obj-list
109 test_expect_success 'write midx with twelve packs' '
110 git multi-pack-index --object-dir=. write &&