(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git apply --whitespace=strip and configuration file.\n'> <'\n'>)}
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\tmkdir sub &&\n'> <'\techo A >sub/file1 &&\n'> <'\tcp sub/file1 saved &&\n'> 
          <'\tgit add sub/file1 &&\n'> <'\techo "B " >sub/file1 &&\n'> <'\tgit diff >patch.file\n'>
        )
      }
    )
    (command.AndOr
      ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
      children: [
        (command.Simple
          words: [{<tr>} {(SQ <_>)} {(SQ <' '>)}]
          redirects: [
            (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<gpatch.file>})
            (redir
              op: <Id.Redir_DLess '<<'>
              loc: (redir_loc.Fd fd:0)
              arg: 
                (redir_param.HereDoc
                  here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
                  here_end_span_id: 67
                  stdin_parts: [
                    <'--- file1\t2007-02-21 01:04:24.000000000 -0800\n'>
                    <'+++ file1+\t2007-02-21 01:07:44.000000000 -0800\n'>
                    <'@@ -1 +1 @@\n'>
                    <'-A\n'>
                    <'+B_\n'>
                  ]
                )
            )
          ]
          do_fork: T
        )
        (command.Simple
          words: [{<sed>} {<-e>} {(SQ <'s|file1|sub/&|'>)} {<gpatch.file>}]
          redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<gpatch-sub.file>})]
          do_fork: T
        )
        (command.Simple
          words: [
            {<sed>}
            {<-e>}
            {(SQ <'\n'> <'\t/^--- /s|file1|a/sub/&|\n'> <'\t/^+++ /s|file1|b/sub/&|\n'>)}
            {<gpatch.file>}
          ]
          redirects: [
            (redir
              op: <Id.Redir_Great '>'>
              loc: (redir_loc.Fd fd:1)
              arg: {<gpatch-ab-sub.file>}
            )
          ]
          do_fork: T
        )
        (command.ShFunction
          name: check_result
          body: 
            (BraceGroup
              children: [
                (command.If
                  arms: [
                    (if_arm
                      cond: 
                        (condition.Shell
                          commands: [(C {<grep>} {(DQ <' '>)} {(DQ ($ Id.VSub_Number '$1'))})]
                        )
                      action: [(C {<echo>} {(DQ <'Eh?'>)}) (C {<false>})]
                      spids: [110 123]
                    )
                    (if_arm
                      cond: 
                        (condition.Shell
                          commands: [(C {<grep>} {<B>} {(DQ ($ Id.VSub_Number '$1'))})]
                        )
                      action: [(C {<echo>} {<Happy>})]
                      spids: [136 147]
                    )
                  ]
                  else_action: [(C {<echo>} {(DQ <'Huh?'>)}) (C {<false>})]
                )
              ]
            )
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <'apply --whitespace=strip'>)} 
      {
        (SQ <'\n'> <'\n'> <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> 
          <'\tgit update-index --refresh &&\n'> <'\n'> <'\tgit apply --whitespace=strip patch.file &&\n'> <'\tcheck_result sub/file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'apply --whitespace=strip from config'>)} 
      {
        (SQ <'\n'> <'\n'> <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> 
          <'\tgit update-index --refresh &&\n'> <'\n'> <'\tgit config apply.whitespace strip &&\n'> <'\tgit apply patch.file &&\n'> 
          <'\tcheck_result sub/file1\n'>
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:D)
          op: assign_op.Equal
          rhs: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<pwd>}))}
          spids: [210]
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <'apply --whitespace=strip in subdir'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcd "$D" &&\n'> <'\tgit config --unset-all apply.whitespace &&\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> <'\tcd sub &&\n'> 
          <'\tgit apply --whitespace=strip ../patch.file &&\n'> <'\tcheck_result file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'apply --whitespace=strip from config in subdir'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcd "$D" &&\n'> <'\tgit config apply.whitespace strip &&\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> <'\tcd sub &&\n'> 
          <'\tgit apply ../patch.file &&\n'> <'\tcheck_result file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'same in subdir but with traditional patch input'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcd "$D" &&\n'> <'\tgit config apply.whitespace strip &&\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> <'\tcd sub &&\n'> 
          <'\tgit apply ../gpatch.file &&\n'> <'\tcheck_result file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'same but with traditional patch input of depth 1'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcd "$D" &&\n'> <'\tgit config apply.whitespace strip &&\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> <'\tcd sub &&\n'> 
          <'\tgit apply ../gpatch-sub.file &&\n'> <'\tcheck_result file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'same but with traditional patch input of depth 2'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcd "$D" &&\n'> <'\tgit config apply.whitespace strip &&\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> <'\tcd sub &&\n'> 
          <'\tgit apply ../gpatch-ab-sub.file &&\n'> <'\tcheck_result file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'same but with traditional patch input of depth 1'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcd "$D" &&\n'> <'\tgit config apply.whitespace strip &&\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> 
          <'\tgit apply -p0 gpatch-sub.file &&\n'> <'\tcheck_result sub/file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'same but with traditional patch input of depth 2'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcd "$D" &&\n'> <'\tgit config apply.whitespace strip &&\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> 
          <'\tgit apply gpatch-ab-sub.file &&\n'> <'\tcheck_result sub/file1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'in subdir with traditional patch input'>)} 
      {
        (SQ <'\n'> <'\tcd "$D" &&\n'> <'\tgit config apply.whitespace strip &&\n'> 
          <'\tcat >.gitattributes <<-EOF &&\n'> <'\t/* whitespace=blank-at-eol\n'> <'\tsub/* whitespace=-blank-at-eol\n'> <'\tEOF\n'> 
          <'\trm -f sub/file1 &&\n'> <'\tcp saved sub/file1 &&\n'> <'\tgit update-index --refresh &&\n'> <'\n'> <'\tcd sub &&\n'> 
          <'\tgit apply ../gpatch.file &&\n'> <'\techo "B " >expect &&\n'> <'\ttest_cmp expect file1\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)