(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'apply same filename'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\n'> <'\tmkdir -p some/sub/dir &&\n'> <'\techo Hello > some/sub/dir/file &&\n'> 
          <'\tgit add some/sub/dir/file &&\n'> <'\tgit commit -m initial &&\n'> <'\tgit tag initial\n'> <'\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 50
          stdin_parts: [
            ('diff a/bla/blub/dir/file b/bla/blub/dir/file\n')
            ('--- a/bla/blub/dir/file\n')
            ('+++ b/bla/blub/dir/file\n')
            ('@@ -1,1 +1,1 @@\n')
            ('-Hello\n')
            ('+Bello\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'apply --directory -p (1)'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit apply --directory=some/sub -p3 --index patch &&\n'> 
          <'\ttest Bello = $(git show :some/sub/dir/file) &&\n'> <'\ttest Bello = $(cat some/sub/dir/file)\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'apply --directory -p (2) '>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit reset --hard initial &&\n'> 
          <'\tgit apply --directory=some/sub/ -p3 --index patch &&\n'> <'\ttest Bello = $(git show :some/sub/dir/file) &&\n'> <'\ttest Bello = $(cat some/sub/dir/file)\n'> 
          <'\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 103
          stdin_parts: [
            ('diff --git a/newfile b/newfile\n')
            ('new file mode 100644\n')
            ('index 0000000..d95f3ad\n')
            ('--- /dev/null\n')
            ('+++ b/newfile\n')
            ('@@ -0,0 +1 @@\n')
            ('+content\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'apply --directory (new file)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard initial &&\n'> 
          <'\tgit apply --directory=some/sub/dir/ --index patch &&\n'> <'\ttest content = $(git show :some/sub/dir/newfile) &&\n'> 
          <'\ttest content = $(cat some/sub/dir/newfile)\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 138
          stdin_parts: [
            ('diff --git a/c/newfile2 b/c/newfile2\n')
            ('new file mode 100644\n')
            ('index 0000000..d95f3ad\n')
            ('--- /dev/null\n')
            ('+++ b/c/newfile2\n')
            ('@@ -0,0 +1 @@\n')
            ('+content\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'apply --directory -p (new file)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard initial &&\n'> 
          <'\tgit apply -p2 --directory=some/sub/dir/ --index patch &&\n'> <'\ttest content = $(git show :some/sub/dir/newfile2) &&\n'> 
          <'\ttest content = $(cat some/sub/dir/newfile2)\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 173
          stdin_parts: [
            ('diff --git a/delfile b/delfile\n')
            ('deleted file mode 100644\n')
            ('index d95f3ad..0000000\n')
            ('--- a/delfile\n')
            ('+++ /dev/null\n')
            ('@@ -1 +0,0 @@\n')
            ('-content\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'apply --directory (delete file)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard initial &&\n'> <'\techo content >some/sub/dir/delfile &&\n'> 
          <'\tgit add some/sub/dir/delfile &&\n'> <'\tgit apply --directory=some/sub/dir/ --index patch &&\n'> <'\t! (git ls-files | grep delfile)\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(SQ <EOF>)}
          here_end_span_id: 210
          stdin_parts: [
            ('diff --git "a/qu\\157tefile" "b/qu\\157tefile"\n')
            ('new file mode 100644\n')
            ('index 0000000..d95f3ad\n')
            ('--- /dev/null\n')
            ('+++ "b/qu\\157tefile"\n')
            ('@@ -0,0 +1 @@\n')
            ('+content\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'apply --directory (quoted filename)'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard initial &&\n'> 
          <'\tgit apply --directory=some/sub/dir/ --index patch &&\n'> <'\ttest content = $(git show :some/sub/dir/quotefile) &&\n'> 
          <'\ttest content = $(cat some/sub/dir/quotefile)\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)