(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ <'Pathspec restrictions\n'> <'\n'> <'Prepare:\n'> <'        file0\n'> 
                <'        path1/file1\n'>
              )
            }
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.Sentence
      child: (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/diff-lib.sh'>})
      terminator: <Id.Op_Semi _>
    )
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'echo frotz >file0 &&\n'> <'     mkdir path1 &&\n'> <'     echo rezrov >path1/file1 &&\n'> 
          <'     git update-index --add file0 path1/file1 &&\n'> <'     tree=$(git write-tree) &&\n'> <'     echo "$tree" &&\n'> <'     echo nitfol >file0 &&\n'> 
          <'     echo yomin >path1/file1 &&\n'> <'     git update-index file0 path1/file1'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 68
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'limit to path should show nothing'>)} 
      {
        (SQ <'git diff-index --cached $tree -- path >current &&\n'> 
          <'     compare_diff_raw current expected'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 95
              stdin_parts: [
                <
':100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M\tpath1/file1\n'
                >
              ]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'limit to path1 should show path1/file1'>)} 
      {
        (SQ <'git diff-index --cached $tree -- path1 >current &&\n'> 
          <'     compare_diff_raw current expected'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 122
              stdin_parts: [
                <
':100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M\tpath1/file1\n'
                >
              ]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'limit to path1/ should show path1/file1'>)} 
      {
        (SQ <'git diff-index --cached $tree -- path1/ >current &&\n'> 
          <'     compare_diff_raw current expected'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 149
              stdin_parts: [
                <
':100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M\tpath1/file1\n'
                >
              ]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'"*file1" should show path1/file1'>)} 
      {
        (SQ <'git diff-index --cached $tree -- "*file1" >current &&\n'> 
          <'     compare_diff_raw current expected'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 176
              stdin_parts: [
                <
':100644 100644 8e4020bb5a8d8c873b25de15933e75cc0fc275df dca6b92303befc93086aa025d90a5facd7eb2812 M\tfile0\n'
                >
              ]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'limit to file0 should show file0'>)} 
      {
        (SQ <'git diff-index --cached $tree -- file0 >current &&\n'> 
          <'     compare_diff_raw current expected'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 202
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'limit to file0/ should emit nothing.'>)} 
      {
        (SQ <'git diff-index --cached $tree -- file0/ >current &&\n'> 
          <'     compare_diff_raw current expected'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-tree pathspec'>)} 
      {
        (SQ <'\n'> <'\ttree2=$(git write-tree) &&\n'> <'\techo "$tree2" &&\n'> 
          <'\tgit diff-tree -r --name-only $tree $tree2 -- pa path1/a >current &&\n'> <'\t>expected &&\n'> <'\ttest_cmp expected current\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-tree with wildcard shows dir also matches'>)} 
      {
        (SQ <'\n'> <'\tgit diff-tree --name-only $EMPTY_TREE $tree -- "f*" >result &&\n'> 
          <'\techo file0 >expected &&\n'> <'\ttest_cmp expected result\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-tree -r with wildcard'>)} 
      {
        (SQ <'\n'> <'\tgit diff-tree -r --name-only $EMPTY_TREE $tree -- "*file1" >result &&\n'> 
          <'\techo path1/file1 >expected &&\n'> <'\ttest_cmp expected result\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-tree with wildcard shows dir also matches'>)} 
      {
        (SQ <'\n'> <'\tgit diff-tree --name-only $tree $tree2 -- "path1/f*" >result &&\n'> 
          <'\techo path1 >expected &&\n'> <'\ttest_cmp expected result\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-tree -r with wildcard from beginning'>)} 
      {
        (SQ <'\n'> <'\tgit diff-tree -r --name-only $tree $tree2 -- "path1/*file1" >result &&\n'> 
          <'\techo path1/file1 >expected &&\n'> <'\ttest_cmp expected result\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-tree -r with wildcard'>)} 
      {
        (SQ <'\n'> <'\tgit diff-tree -r --name-only $tree $tree2 -- "path1/f*" >result &&\n'> 
          <'\techo path1/file1 >expected &&\n'> <'\ttest_cmp expected result\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'setup submodules'>)} 
      {
        (SQ <'\n'> <'\ttest_tick &&\n'> <'\tgit init submod &&\n'> 
          <'\t( cd submod && test_commit first; ) &&\n'> <'\tgit add submod &&\n'> <'\tgit commit -m first &&\n'> 
          <'\t( cd submod && test_commit second; ) &&\n'> <'\tgit add submod &&\n'> <'\tgit commit -m second\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-tree ignores trailing slash on submodule path'>)} 
      {
        (SQ <'\n'> <'\tgit diff --name-only HEAD^ HEAD submod >expect &&\n'> 
          <'\tgit diff --name-only HEAD^ HEAD submod/ >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff multiple wildcard pathspecs'>)} 
      {
        (SQ <'\n'> <'\tmkdir path2 &&\n'> <'\techo rezrov >path2/file1 &&\n'> 
          <'\tgit update-index --add path2/file1 &&\n'> <'\ttree3=$(git write-tree) &&\n'> 
          <'\tgit diff --name-only $tree $tree3 -- "path2*1" "path1*1" >actual &&\n'> <'\tcat <<-\\EOF >expect &&\n'> <'\tpath1/file1\n'> <'\tpath2/file1\n'> <'\tEOF\n'> 
          <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff-cache ignores trailing slash on submodule path'>)} 
      {
        (SQ <'\n'> <'\tgit diff --name-only HEAD^ submod >expect &&\n'> 
          <'\tgit diff --name-only HEAD^ submod/ >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)