t5308: check that index-pack --strict detects duplicate objects
Commit 68be2fea (receive-pack, fetch-pack: reject bogus pack that records objects twice, 2011-11-16) taught index-pack to notice and reject duplicate objects if --strict is given (which it is for incoming packs, if transfer.fsckObjects is set). However, it never tested the code, because we did not have an easy way of generating such a bogus pack. Now that we have test infrastructure to handle this, let's confirm that it works. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Sep 4, 2013 at 05:01 UTC
16c159d75af29b1929af0e2f341d26fce4e1d546
1 file changed
+7
t/t5308-pack-detect-duplicates.sh
+7
@@ -70,4 +70,11 @@ test_expect_success 'lookup in duplicated pack (GIT_USE_LOOKUP)' '
70
test_cmp expect actual
71
'
72
73
+test_expect_success 'index-pack can reject packs with duplicates' '
74
+ clear_packs &&
75
+ create_pack dups.pack 2 &&
76
+ test_must_fail git index-pack --strict --stdin <dups.pack &&
77
+ test_expect_code 1 git cat-file -e $LO_SHA1
78
+'
79
+
80
test_done