(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"apply same filename">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(patch)} spids:[35])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [39]
        )
      ]
    )
    (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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(patch)} spids:[85])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [89]
        )
      ]
    )
    (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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(patch)} spids:[118])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [122]
        )
      ]
    )
    (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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(patch)} spids:[151])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("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")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [155]
        )
      ]
    )
    (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">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(patch)} spids:[185])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {("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")
            }
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [189]
        )
      ]
    )
    (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)})
  ]
)