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