74
74
test_expect_success \
75
'unpack with REF_DELTA' \
76
76
'GIT_OBJECT_DIRECTORY=.git2/objects &&
77
77
export GIT_OBJECT_DIRECTORY &&
79
79
git-unpack-objects -n <test-2-${packname_2}.pack &&
80
80
git-unpack-objects <test-2-${packname_2}.pack'
82
82
unset GIT_OBJECT_DIRECTORY
84
84
test_expect_success \
85
'check unpack with delta' \
86
'(cd ../.git && find objects -type f -print) |
89
cmp $path ../.git/$path || {
85
'check unpack with REF_DELTA' \
86
'(cd ../.git && find objects -type f -print) |
89
cmp $path ../.git/$path || {
97
'pack with OFS_DELTA' \
99
packname_3=$(git-pack-objects --delta-base-offset test-3 <obj-list)'
104
test_expect_success \
105
'unpack with OFS_DELTA' \
106
'GIT_OBJECT_DIRECTORY=.git2/objects &&
107
export GIT_OBJECT_DIRECTORY &&
109
git-unpack-objects -n <test-3-${packname_3}.pack &&
110
git-unpack-objects <test-3-${packname_3}.pack'
112
unset GIT_OBJECT_DIRECTORY
114
test_expect_success \
115
'check unpack with OFS_DELTA' \
116
'(cd ../.git && find objects -type f -print) |
119
cmp $path ../.git/$path || {
126
test_expect_success 'compare delta flavors' '
128
defined($_ = -s $_) or die for @ARGV;
129
exit 1 if $ARGV[0] <= $ARGV[1];
130
'\'' test-2-$packname_2.pack test-3-$packname_3.pack
112
149
diff expect current'
115
151
test_expect_success \
116
'use packed deltified objects' \
152
'use packed deltified (REF_DELTA) objects' \
117
153
'GIT_OBJECT_DIRECTORY=.git2/objects &&
118
154
export GIT_OBJECT_DIRECTORY &&
119
rm -f .git2/objects/pack/test-?.idx &&
155
rm .git2/objects/pack/test-* &&
120
156
cp test-2-${packname_2}.pack test-2-${packname_2}.idx .git2/objects/pack && {
121
157
git-diff-tree --root -p $commit &&
122
158
while read object
128
164
diff expect current'
166
test_expect_success \
167
'use packed deltified (OFS_DELTA) objects' \
168
'GIT_OBJECT_DIRECTORY=.git2/objects &&
169
export GIT_OBJECT_DIRECTORY &&
170
rm .git2/objects/pack/test-* &&
171
cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && {
172
git-diff-tree --root -p $commit &&
175
t=`git-cat-file -t $object` &&
176
git-cat-file $t $object || return 1
130
181
unset GIT_OBJECT_DIRECTORY
132
183
test_expect_success \
134
'git-verify-pack test-1-${packname_1}.idx test-2-${packname_2}.idx'
185
'git-verify-pack test-1-${packname_1}.idx \
186
test-2-${packname_2}.idx \
187
test-3-${packname_3}.idx'
136
189
test_expect_success \
137
190
'corrupt a pack and see if verify catches' \
194
247
git-index-pack test-3.pack &&
195
248
cmp test-3.idx test-2-${packname_2}.idx &&
250
cp test-3-${packname_3}.pack test-3.pack &&
251
git-index-pack -o tmp.idx test-3-${packname_3}.pack &&
252
cmp tmp.idx test-3-${packname_3}.idx &&
254
git-index-pack test-3.pack &&
255
cmp test-3.idx test-3-${packname_3}.idx &&
259
test_expect_success \
260
'fake a SHA1 hash collision' \
261
'test -f .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67 &&
262
cp -f .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
263
.git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
265
test_expect_failure \
266
'make sure index-pack detects the SHA1 collision' \
267
'git-index-pack -o bad.idx test-3.pack'