t5300: add test for "unpack-objects --strict"
This adds test for unpacking deltified objects with --strict option. - unpacking full trees with --strict should pass; - unpacking only trees with --strict should be rejected due to missing blobs; - unpacking only trees with --strict into an existing repository with necessary blobs should succeed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Mar 5, 2008 at 00:14 UTC
c0e809e5c027443d6f77714a1c5f8c6233ca0a20
1 file changed
+48
t/t5300-pack-object.sh
+48
@@ -274,4 +274,52 @@ test_expect_success \
274
packname_4=$(git pack-objects test-4 <obj-list) &&
275
test 3 = $(ls test-4-*.pack | wc -l)'
276
277
+test_expect_failure 'unpacking with --strict' '
278
+
279
+ git config --unset pack.packsizelimit &&
280
+ for j in a b c d e f g
281
+ do
282
+ for i in 0 1 2 3 4 5 6 7 8 9
283
+ do
284
+ o=$(echo $j$i | git hash-object -w --stdin) &&
285
+ echo "100644 $o 0 $j$i"
286
+ done
287
+ done >LIST &&
288
+ rm -f .git/index &&
289
+ git update-index --index-info <LIST &&
290
+ LIST=$(git write-tree) &&
291
+ rm -f .git/index &&
292
+ head -n 10 LIST | git update-index --index-info &&
293
+ LI=$(git write-tree) &&
294
+ rm -f .git/index &&
295
+ tail -n 10 LIST | git update-index --index-info &&
296
+ ST=$(git write-tree) &&
297
+ PACK5=$( git rev-list --objects "$LIST" "$LI" "$ST" | \
298
+ git pack-objects test-5 ) &&
299
+ PACK6=$( (
300
+ echo "$LIST"
301
+ echo "$LI"
302
+ echo "$ST"
303
+ ) | git pack-objects test-6 ) &&
304
+ test_create_repo test-5 &&
305
+ (
306
+ cd test-5 &&
307
+ git unpack-objects --strict <../test-5-$PACK5.pack &&
308
+ git ls-tree -r $LIST &&
309
+ git ls-tree -r $LI &&
310
+ git ls-tree -r $ST
311
+ ) &&
312
+ test_create_repo test-6 &&
313
+ (
314
+ # tree-only into empty repo -- many unreachables
315
+ cd test-6 &&
316
+ test_must_fail git unpack-objects --strict <../test-6-$PACK6.pack
317
+ ) &&
318
+ (
319
+ # already populated -- no unreachables
320
+ cd test-5 &&
321
+ git unpack-objects --strict <../test-6-$PACK6.pack
322
+ )
323
+'
324
+
325
test_done