summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-09-04 05:01:53 -0400
committerJunio C Hamano <gitster@pobox.com>2013-09-04 10:52:01 -0700
commit16c159d75af29b1929af0e2f341d26fce4e1d546 (patch)
treebac26563bcc66426ea08d526208db5f068376c11
parentb2ef3d9ebb95ce369330d1f09db361aa39c67013 (diff)
downloadgit-16c159d75af29b1929af0e2f341d26fce4e1d546.tar.gz
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>
-rwxr-xr-xt/t5308-pack-detect-duplicates.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t5308-pack-detect-duplicates.sh b/t/t5308-pack-detect-duplicates.sh
index 04fe242410..9c5a8766ab 100755
--- a/t/t5308-pack-detect-duplicates.sh
+++ b/t/t5308-pack-detect-duplicates.sh
@@ -70,4 +70,11 @@ test_expect_success 'lookup in duplicated pack (GIT_USE_LOOKUP)' '
test_cmp expect actual
'
+test_expect_success 'index-pack can reject packs with duplicates' '
+ clear_packs &&
+ create_pack dups.pack 2 &&
+ test_must_fail git index-pack --strict --stdin <dups.pack &&
+ test_expect_code 1 git cat-file -e $LO_SHA1
+'
+
test_done