6
6
test_description=' pack index with 64-bit offsets and object CRC'
7
7
. ./test-lib.sh
8
8
9
- test_expect_success \
10
- ' setup' \
11
- ' rm -rf .git &&
9
+ test_expect_success ' setup' '
10
+ test_oid_init &&
11
+ rawsz=$(test_oid rawsz) &&
12
+ rm -rf .git &&
12
13
git init &&
13
14
git config pack.threads 1 &&
14
15
i=1 &&
@@ -32,7 +33,8 @@ test_expect_success \
32
33
echo $tree &&
33
34
git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
34
35
} >obj-list &&
35
- git update-ref HEAD $commit'
36
+ git update-ref HEAD $commit
37
+ '
36
38
37
39
test_expect_success \
38
40
' pack-objects with index version 1' \
@@ -157,10 +159,11 @@ test_expect_success \
157
159
offs_101=$(index_obj_offset 1.idx $sha1_101) &&
158
160
nr_099=$(index_obj_nr 1.idx $sha1_099) &&
159
161
chmod +w ".git/objects/pack/pack-${pack1}.pack" &&
162
+ recordsz=$((rawsz + 4)) &&
160
163
dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($offs_101 + 1)) \
161
164
if=".git/objects/pack/pack-${pack1}.idx" \
162
- skip=$((4 + 256 * 4 + $nr_099 * 24 )) \
163
- bs=1 count=20 conv=notrunc &&
165
+ skip=$((4 + 256 * 4 + $nr_099 * recordsz )) \
166
+ bs=1 count=$rawsz conv=notrunc &&
164
167
git cat-file blob $sha1_101 > file_101_foo1'
165
168
166
169
test_expect_success \
@@ -200,8 +203,8 @@ test_expect_success \
200
203
chmod +w ".git/objects/pack/pack-${pack1}.pack" &&
201
204
dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($offs_101 + 1)) \
202
205
if=".git/objects/pack/pack-${pack1}.idx" \
203
- skip=$((8 + 256 * 4 + $nr_099 * 20 )) \
204
- bs=1 count=20 conv=notrunc &&
206
+ skip=$((8 + 256 * 4 + $nr_099 * rawsz )) \
207
+ bs=1 count=$rawsz conv=notrunc &&
205
208
git cat-file blob $sha1_101 > file_101_foo2'
206
209
207
210
test_expect_success \
@@ -226,7 +229,7 @@ test_expect_success \
226
229
nr=$(index_obj_nr ".git/objects/pack/pack-${pack1}.idx" $obj) &&
227
230
chmod +w ".git/objects/pack/pack-${pack1}.idx" &&
228
231
printf xxxx | dd of=".git/objects/pack/pack-${pack1}.idx" conv=notrunc \
229
- bs=1 count=4 seek=$((8 + 256 * 4 + $(wc -l <obj-list) * 20 + $nr * 4)) &&
232
+ bs=1 count=4 seek=$((8 + 256 * 4 + $(wc -l <obj-list) * rawsz + $nr * 4)) &&
230
233
( while read obj
231
234
do git cat-file -p $obj >/dev/null || exit 1
232
235
done <obj-list ) &&
0 commit comments