Skip to content

Commit 16c159d

Browse files
peffgitster
authored andcommitted
t5308: check that index-pack --strict detects duplicate objects
Commit 68be2fe (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b2ef3d9 commit 16c159d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

t/t5308-pack-detect-duplicates.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,11 @@ test_expect_success 'lookup in duplicated pack (GIT_USE_LOOKUP)' '
7070
test_cmp expect actual
7171
'
7272

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+
7380
test_done

0 commit comments

Comments
 (0)