(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ <'git ls-tree directory and filenames handling.\n'> <'\n'> 
                <'This test runs git ls-tree with the following in a tree.\n'> <'\n'> <'    1.txt              - a file\n'> <'    2.txt              - a file\n'> 
                <'    path0/a/b/c/1.txt  - a file in a directory\n'> <'    path1/b/c/1.txt    - a file in a directory\n'> 
                <'    path2/1.txt        - a file in a directory\n'> <'    path3/1.txt        - a file in a directory\n'> 
                <'    path3/2.txt        - a file in a directory\n'> <'\n'> <'Test the handling of multiple directories which have matching file\n'> 
                <'entries.  Also test odd filename and missing entries handling.\n'>
              )
            }
          spids: [16]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\techo 111 >1.txt &&\n'> <'\techo 222 >2.txt &&\n'> 
          <'\tmkdir path0 path0/a path0/a/b path0/a/b/c &&\n'> <'\techo 111 >path0/a/b/c/1.txt &&\n'> <'\tmkdir path1 path1/b path1/b/c &&\n'> 
          <'\techo 111 >path1/b/c/1.txt &&\n'> <'\tmkdir path2 &&\n'> <'\techo 111 >path2/1.txt &&\n'> <'\tmkdir path3 &&\n'> 
          <'\techo 111 >path3/1.txt &&\n'> <'\techo 222 >path3/2.txt &&\n'> <'\tfind *.txt path* \\( -type f -o -type l \\) -print |\n'> 
          <'\txargs git update-index --add &&\n'> <'\ttree=$(git write-tree) &&\n'> <'\techo $tree\n'>
        )
      }
    )
    (command.ShFunction
      name: test_output
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [{<sed>} {<-e>} {(DQ <'s/ '> ($ Id.VSub_DollarName '$_x40') <'\t/ X\t/'>)}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Less '<'>
                      loc: (redir_loc.Fd fd:0)
                      arg: {<current>}
                    )
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<check>}
                    )
                  ]
                  do_fork: T
                )
                (C {<test_cmp>} {<expected>} {<check>})
              ]
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'ls-tree plain'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> 
          <'100644 blob X\t1.txt\n'> <'100644 blob X\t2.txt\n'> <'040000 tree X\tpath0\n'> <'040000 tree X\tpath1\n'> 
          <'040000 tree X\tpath2\n'> <'040000 tree X\tpath3\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree recursive'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree -r $tree >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> 
          <'100644 blob X\t1.txt\n'> <'100644 blob X\t2.txt\n'> <'100644 blob X\tpath0/a/b/c/1.txt\n'> <'100644 blob X\tpath1/b/c/1.txt\n'> 
          <'100644 blob X\tpath2/1.txt\n'> <'100644 blob X\tpath3/1.txt\n'> <'100644 blob X\tpath3/2.txt\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree filter 1.txt'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree 1.txt >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> 
          <'100644 blob X\t1.txt\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree filter path1/b/c/1.txt'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree path1/b/c/1.txt >current &&\n'> 
          <'\tcat >expected <<\\EOF &&\n'> <'100644 blob X\tpath1/b/c/1.txt\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree filter all 1.txt files'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree 1.txt path0/a/b/c/1.txt \\\n'> 
          <'\t\tpath1/b/c/1.txt path2/1.txt path3/1.txt >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> <'100644 blob X\t1.txt\n'> <'100644 blob X\tpath0/a/b/c/1.txt\n'> 
          <'100644 blob X\tpath1/b/c/1.txt\n'> <'100644 blob X\tpath2/1.txt\n'> <'100644 blob X\tpath3/1.txt\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree filter directories'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree path3 path2 path0/a/b/c path1/b/c path0/a >current &&\n'> 
          <'\tcat >expected <<\\EOF &&\n'> <'040000 tree X\tpath0/a/b/c\n'> <'040000 tree X\tpath1/b/c\n'> <'040000 tree X\tpath2\n'> 
          <'040000 tree X\tpath3\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree filter odd names'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree 1.txt ./1.txt .//1.txt \\\n'> 
          <'\t\tpath3/1.txt path3/./1.txt path3 path3// >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> <'100644 blob X\t1.txt\n'> <'100644 blob X\tpath3/1.txt\n'> 
          <'100644 blob X\tpath3/2.txt\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree filter missing files and extra slashes'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree 1.txt/ abc.txt \\\n'> 
          <'\t\tpath3//23.txt path3/2.txt/// >current &&\n'> <'\t>expected &&\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree filter is leading path match'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree $tree pa path3/a >current &&\n'> <'\t>expected &&\n'> 
          <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree --full-name'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd path0 &&\n'> <'\t\tgit ls-tree --full-name $tree a\n'> 
          <'\t) >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> <'040000 tree X\tpath0/a\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree --full-tree'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd path1/b/c &&\n'> <'\t\tgit ls-tree --full-tree $tree\n'> 
          <'\t) >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> <'100644 blob X\t1.txt\n'> <'100644 blob X\t2.txt\n'> 
          <'040000 tree X\tpath0\n'> <'040000 tree X\tpath1\n'> <'040000 tree X\tpath2\n'> <'040000 tree X\tpath3\n'> <'EOF\n'> 
          <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree --full-tree -r'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd path3/ &&\n'> <'\t\tgit ls-tree --full-tree -r $tree\n'> 
          <'\t) >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> <'100644 blob X\t1.txt\n'> <'100644 blob X\t2.txt\n'> 
          <'100644 blob X\tpath0/a/b/c/1.txt\n'> <'100644 blob X\tpath1/b/c/1.txt\n'> <'100644 blob X\tpath2/1.txt\n'> <'100644 blob X\tpath3/1.txt\n'> 
          <'100644 blob X\tpath3/2.txt\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree --abbrev=5'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree --abbrev=5 $tree >current &&\n'> 
          <'\tsed -e "s/ $_x05[0-9a-f]*\t/ X\t/" <current >check &&\n'> <'\tcat >expected <<\\EOF &&\n'> <'100644 blob X\t1.txt\n'> <'100644 blob X\t2.txt\n'> 
          <'040000 tree X\tpath0\n'> <'040000 tree X\tpath1\n'> <'040000 tree X\tpath2\n'> <'040000 tree X\tpath3\n'> <'EOF\n'> 
          <'\ttest_cmp expected check\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree --name-only'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree --name-only $tree >current &&\n'> <'\tcat >expected <<\\EOF &&\n'> 
          <'1.txt\n'> <'2.txt\n'> <'path0\n'> <'path1\n'> <'path2\n'> <'path3\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'ls-tree --name-only -r'>)} 
      {
        (SQ <'\n'> <'\tgit ls-tree --name-only -r $tree >current &&\n'> 
          <'\tcat >expected <<\\EOF &&\n'> <'1.txt\n'> <'2.txt\n'> <'path0/a/b/c/1.txt\n'> <'path1/b/c/1.txt\n'> <'path2/1.txt\n'> <'path3/1.txt\n'> 
          <'path3/2.txt\n'> <'EOF\n'> <'\ttest_output\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)