(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'git-apply --ignore-whitespace.\n'> <'\n'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch1.patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 68
          stdin_parts: [
            ('diff --git a/main.c b/main.c\n')
            ('new file mode 100644\n')
            ('--- /dev/null\n')
            ('+++ b/main.c\n')
            ('@@ -0,0 +1,22 @@\n')
            ('+#include <stdio.h>\n')
            ('+\n')
            ('+void print_int(int num);\n')
            ('+int func(int num);\n')
            ('+\n')
            ('+int main() {\n')
            ('+       int i;\n')
            ('+\n')
            ('+       for (i = 0; i < 10; i++) {\n')
            ('+               print_int(func(i)); /* stuff */\n')
            ('+       }\n')
            ('+\n')
            ('+       return 0;\n')
            ('+}\n')
            ('+\n')
            ('+int func(int num) {\n')
            ('+       return num * num;\n')
            ('+}\n')
            ('+\n')
            ('+void print_int(int num) {\n')
            ('+       printf("%d", num);\n')
            ('+}\n')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(sed)} {(-e)} {(SQ <'s/Z/ /g'>)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch2.patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 115
          stdin_parts: [
            ('diff --git a/main.c b/main.c\n')
            ('--- a/main.c\n')
            ('+++ b/main.c\n')
            ('@@ -10,6 +10,8 @@\n')
            ('Z\t\tprint_int(func(i)); /* stuff */\n')
            ('Z\t}\n')
            ('Z\n')
            ('+\tprintf("\\n");\n')
            ('+\n')
            ('Z\treturn 0;\n')
            ('Z}\n')
            ('Z\n')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(sed)} {(-e)} {(SQ <'s/Z/ /g'>)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch3.patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 154
          stdin_parts: [
            ('diff --git a/main.c b/main.c\n')
            ('--- a/main.c\n')
            ('+++ b/main.c\n')
            ('@@ -10,3 +10,4 @@\n')
            ('Z\tfor (i = 0; i < 10; i++) {\n')
            ('Z\t\tprint_int(func(i));Z\n')
            ('+\t\t/* stuff */\n')
            ('Z\t}\n')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(sed)} {(-e)} {(SQ <'s/Z/ /g'>)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch4.patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 186
          stdin_parts: [
            ('diff --git a/main.c b/main.c\n')
            ('--- a/main.c\n')
            ('+++ b/main.c\n')
            ('@@ -21,1 +21,1 @@\n')
            ('-\t};Z\n')
            ('\\ No newline at end of file\n')
            ('+\t};\n')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(sed)} {(-e)} {(SQ <'s/Z/ /g'>)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch5.patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 215
          stdin_parts: [
            ('diff --git a/main.c b/main.c\n')
            ('--- a/main.c\n')
            ('+++ b/main.c\n')
            ('@@ -2,2 +2,3 @@\n')
            ('Z\tvoid print_int(int num);\n')
            ('+\t/* a comment */\n')
            ('Z\tint func(int num);\n')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(sed)} {(-e)} {(SQ <'s/T/\t/g'>)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(main.c.final)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 264
          stdin_parts: [
            ('#include <stdio.h>\n')
            ('\n')
            ('void print_int(int num);\n')
            ('int func(int num);\n')
            ('\n')
            ('int main() {\n')
            ('       int i;\n')
            ('\n')
            ('       for (i = 0; i < 10; i++) {\n')
            ('               print_int(func(i)); /* stuff */\n')
            ('       }\n')
            ('\n')
            ('Tprintf("\\n");\n')
            ('\n')
            ('       return 0;\n')
            ('}\n')
            ('\n')
            ('int func(int num) {\n')
            ('       return num * num;\n')
            ('}\n')
            ('\n')
            ('void print_int(int num) {\n')
            ('       printf("%d", num);\n')
            ('}\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'file creation'>)} {(SQ <'\n'> <'\tgit apply patch1.patch\n'>)})
    (C {(test_expect_success)} {(SQ <'patch2 fails (retab)'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git apply patch2.patch\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'patch2 applies with --ignore-whitespace'>)} 
      {(SQ <'\n'> <'\tgit apply --ignore-whitespace patch2.patch\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'patch2 reverse applies with --ignore-space-change'>)} 
      {(SQ <'\n'> <'\tgit apply -R --ignore-space-change patch2.patch\n'>)}
    )
    (C {(git)} {(config)} {(apply.ignorewhitespace)} {(change)})
    (C {(test_expect_success)} {(SQ <'patch2 applies (apply.ignorewhitespace = change)'>)} 
      {(SQ <'\n'> <'\tgit apply patch2.patch &&\n'> <'\ttest_cmp main.c.final main.c\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'patch3 fails (missing string at EOL)'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git apply patch3.patch\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'patch4 fails (missing EOL at EOF)'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git apply patch4.patch\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'patch5 fails (leading whitespace differences matter)'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git apply patch5.patch\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'re-create file (with --ignore-whitespace)'>)} 
      {(SQ <'\n'> <'\trm -f main.c &&\n'> <'\tgit apply patch1.patch\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'patch5 fails (--no-ignore-whitespace)'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git apply --no-ignore-whitespace patch5.patch\n'>)}
    )
    (C {(test_done)})
  ]
)