t5300: add test for "index-pack --strict"
This adds test for indexing packs with --strict option, basically the same as c0e809e (t5300: add test for "unpack-objects --strict") has done for unpack-objects. Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin Koegler committed
Mar 7, 2008 at 08:39 UTC
38a5739dfadd41c9e45bb05ed6fe1559895360cb
1 file changed
+47
t/t5300-pack-object.sh
+47
@@ -322,4 +322,51 @@ test_expect_success 'unpacking with --strict' '
322
)
323
'
324
325
+test_expect_success 'index-pack with --strict' '
326
+
327
+ for j in a b c d e f g
328
+ do
329
+ for i in 0 1 2 3 4 5 6 7 8 9
330
+ do
331
+ o=$(echo $j$i | git hash-object -w --stdin) &&
332
+ echo "100644 $o 0 $j$i"
333
+ done
334
+ done >LIST &&
335
+ rm -f .git/index &&
336
+ git update-index --index-info <LIST &&
337
+ LIST=$(git write-tree) &&
338
+ rm -f .git/index &&
339
+ head -n 10 LIST | git update-index --index-info &&
340
+ LI=$(git write-tree) &&
341
+ rm -f .git/index &&
342
+ tail -n 10 LIST | git update-index --index-info &&
343
+ ST=$(git write-tree) &&
344
+ PACK5=$( git rev-list --objects "$LIST" "$LI" "$ST" | \
345
+ git pack-objects test-5 ) &&
346
+ PACK6=$( (
347
+ echo "$LIST"
348
+ echo "$LI"
349
+ echo "$ST"
350
+ ) | git pack-objects test-6 ) &&
351
+ test_create_repo test-7 &&
352
+ (
353
+ cd test-7 &&
354
+ git index-pack --strict --stdin <../test-5-$PACK5.pack &&
355
+ git ls-tree -r $LIST &&
356
+ git ls-tree -r $LI &&
357
+ git ls-tree -r $ST
358
+ ) &&
359
+ test_create_repo test-8 &&
360
+ (
361
+ # tree-only into empty repo -- many unreachables
362
+ cd test-8 &&
363
+ test_must_fail git index-pack --strict --stdin <../test-6-$PACK6.pack
364
+ ) &&
365
+ (
366
+ # already populated -- no unreachables
367
+ cd test-7 &&
368
+ git index-pack --strict --stdin <../test-6-$PACK6.pack
369
+ )
370
+'
371
+
372
test_done