(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'test tree diff when trees have duplicate entries'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.FuncDef
      name: make_tree_entry
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(printf)} {(SQ <'%s %s\\0'>)} {(DQ ($ VSub_Number '$1'))} {(DQ ($ VSub_Number '$2'))})
                (C {(perl)} {(-e)} {(SQ <'print chr(hex($_)) for ($ARGV[0] =~ /../g)'>)} 
                  {(DQ ($ VSub_Number '$3'))}
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: make_tree
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (command.WhileUntil
                  keyword: <KW_While while>
                  cond: [
                    (command.Sentence
                      child: (C {(test)} {($ VSub_Pound '$#')} {(-gt)} {(2)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  body: 
                    (command.DoGroup
                      children: [
                        (C {(make_tree_entry)} {(DQ ($ VSub_Number '$1'))} {(DQ ($ VSub_Number '$2'))} 
                          {(DQ ($ VSub_Number '$3'))}
                        )
                        (command.Sentence
                          child: (C {(shift)})
                          terminator: <Op_Semi ';'>
                        )
                        (command.Sentence
                          child: (C {(shift)})
                          terminator: <Op_Semi ';'>
                        )
                        (C {(shift)})
                      ]
                    )
                )
                (C {(git)} {(hash-object)} {(-w)} {(-t)} {(tree)} {(--stdin)})
              ]
              negated: F
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ <'create trees with duplicate entries'>)} 
      {
        (SQ <'\n'> <'\tblob_one=$(echo one | git hash-object -w --stdin) &&\n'> 
          <'\tblob_two=$(echo two | git hash-object -w --stdin) &&\n'> <'\tinner_one_a=$(make_tree \\\n'> <'\t\t100644 inner $blob_one\n'> <'\t) &&\n'> 
          <'\tinner_one_b=$(make_tree \\\n'> <'\t\t100644 inner $blob_two \\\n'> <'\t\t100644 inner $blob_two \\\n'> 
          <'\t\t100644 inner $blob_two\n'> <'\t) &&\n'> <'\touter_one=$(make_tree \\\n'> <'\t\t040000 outer $inner_one_a \\\n'> 
          <'\t\t040000 outer $inner_one_b\n'> <'\t) &&\n'> <'\tinner_two=$(make_tree \\\n'> <'\t\t100644 inner $blob_one \\\n'> 
          <'\t\t100644 inner $blob_two \\\n'> <'\t\t100644 inner $blob_two \\\n'> <'\t\t100644 inner $blob_two\n'> <'\t) &&\n'> 
          <'\touter_two=$(make_tree \\\n'> <'\t\t040000 outer $inner_two\n'> <'\t) &&\n'> <'\tgit tag one $outer_one &&\n'> 
          <'\tgit tag two $outer_two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'diff-tree between trees'>)} 
      {
        (SQ <'\n'> <'\t{\n'> <'\t\tprintf ":000000 100644 $_z40 $blob_two A\\touter/inner\\n" &&\n'> 
          <'\t\tprintf ":000000 100644 $_z40 $blob_two A\\touter/inner\\n" &&\n'> <'\t\tprintf ":000000 100644 $_z40 $blob_two A\\touter/inner\\n" &&\n'> 
          <'\t\tprintf ":100644 000000 $blob_two $_z40 D\\touter/inner\\n" &&\n'> <'\t\tprintf ":100644 000000 $blob_two $_z40 D\\touter/inner\\n" &&\n'> 
          <'\t\tprintf ":100644 000000 $blob_two $_z40 D\\touter/inner\\n"\n'> <'\t} >expect &&\n'> <'\tgit diff-tree -r --no-abbrev one two >actual &&\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'diff-tree with renames'>)} 
      {
        (SQ <'\n'> <'\t# same expectation as above, since we disable rename detection\n'> 
          <'\tgit diff-tree -M -r --no-abbrev one two >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)