提交 16c159d7 编写于 作者: J Jeff King 提交者: Junio C Hamano

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: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b2ef3d9e
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册