(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'handling of duplicate objects in incoming packfiles'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-pack.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:LO_SHA1) op: assign_op.Equal rhs: {<e68fe8129b546b101aee9510c5328e7f21ca1d18>} spids: [30] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HI_SHA1) op: assign_op.Equal rhs: {<e69de29bb2d1d6434b8b29ae775ad8c2e48c5391>} spids: [33] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MISSING_SHA1) op: assign_op.Equal rhs: {(SQ <e69d000000000000000000000000000000000000>)} spids: [49] ) ] ) (command.ShFunction name: create_pack body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [ {<pack_header>} { (DQ (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Star left: {<Id.Lit_Digits 2>} right: {($ Id.VSub_Number '$2')} ) ) ) } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_Number '$1'))} ) ] do_fork: T ) (command.ForEach iter_name: i iter_words: [ { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<test_seq>} {<1>} {(DQ ($ Id.VSub_Number '$2'))}) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<pack_obj>} {($ Id.VSub_DollarName '$LO_SHA1')}) (C {<pack_obj>} {($ Id.VSub_DollarName '$HI_SHA1')}) ] ) ] ) redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_Number '$1'))} ) ] ) (C {<pack_trailer>} {(DQ ($ Id.VSub_Number '$1'))}) ] ) ] ) ) (C {<test_expect_success>} {(SQ <'pack with no duplicates'>)} {(SQ <'\n'> <'\tcreate_pack no-dups.pack 1 &&\n'> <'\tgit index-pack --stdin <no-dups.pack\n'>)} ) (C {<test_expect_success>} {(SQ <'index-pack will allow duplicate objects by default'>)} { (SQ <'\n'> <'\tclear_packs &&\n'> <'\tcreate_pack dups.pack 100 &&\n'> <'\tgit index-pack --stdin <dups.pack\n'> ) } ) (C {<test_expect_success>} {(SQ <'create batch-check test vectors'>)} { (SQ <'\n'> <'\tcat >input <<-EOF &&\n'> <'\t$LO_SHA1\n'> <'\t$HI_SHA1\n'> <'\t$MISSING_SHA1\n'> <'\tEOF\n'> <'\tcat >expect <<-EOF\n'> <'\t$LO_SHA1 blob 2\n'> <'\t$HI_SHA1 blob 0\n'> <'\t$MISSING_SHA1 missing\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'lookup in duplicated pack (binary search)'>)} { (SQ <'\n'> <'\tgit cat-file --batch-check <input >actual &&\n'> <'\ttest_cmp expect actual\n'>) } ) (C {<test_expect_success>} {(SQ <'lookup in duplicated pack (GIT_USE_LOOKUP)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tGIT_USE_LOOKUP=1 &&\n'> <'\t\texport GIT_USE_LOOKUP &&\n'> <'\t\tgit cat-file --batch-check <input >actual\n'> <'\t) &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'index-pack can reject packs with duplicates'>)} { (SQ <'\n'> <'\tclear_packs &&\n'> <'\tcreate_pack dups.pack 2 &&\n'> <'\ttest_must_fail git index-pack --strict --stdin <dups.pack &&\n'> <'\ttest_expect_code 1 git cat-file -e $LO_SHA1\n'> ) } ) (C {<test_done>}) ] )