(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'handling of duplicate objects in incoming packfiles'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ VSub_DollarName '$TEST_DIRECTORY')) (/lib-pack.sh)})
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:LO_SHA1)
          op: Equal
          rhs: {(e68fe8129b546b101aee9510c5328e7f21ca1d18)}
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:HI_SHA1)
          op: Equal
          rhs: {(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)}
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:MISSING_SHA1)
          op: Equal
          rhs: {(SQ <e69d000000000000000000000000000000000000>)}
        )
      ]
    )
    (command.FuncDef
      name: create_pack
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [
                    {(pack_header)}
                    {
                      (DQ 
                        (word_part.ArithSubPart
                          anode: 
                            (arith_expr.ArithBinary
                              op_id: Arith_Star
                              left: (arith_expr.ArithWord w:{(Lit_Digits 2)})
                              right: (arith_expr.ArithWord w:{($ VSub_Number '$2')})
                            )
                        )
                      )
                    }
                  ]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(DQ ($ VSub_Number '$1'))}
                    )
                  ]
                )
                (command.ForEach
                  iter_name: i
                  iter_words: [
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(test_seq)} {(1)} {(DQ ($ VSub_Number '$2'))})]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                  ]
                  do_arg_iter: F
                  body: 
                    (command.DoGroup
                      children: [
                        (command.AndOr
                          ops: [Op_DAmp]
                          children: [
                            (C {(pack_obj)} {($ VSub_DollarName '$LO_SHA1')})
                            (C {(pack_obj)} {($ VSub_DollarName '$HI_SHA1')})
                          ]
                        )
                      ]
                    )
                  redirects: [
                    (redir.Redir
                      op: <Redir_DGreat '>>'>
                      fd: 16777215
                      arg_word: {(DQ ($ VSub_Number '$1'))}
                    )
                  ]
                )
                (C {(pack_trailer)} {(DQ ($ 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)})
  ]
)