(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git apply handling criss-cross rename patch.'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: create_file
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:cnt)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [21]
                )
              ]
            )
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [(C {<test>} {($ Id.VSub_DollarName '$cnt')} {<-le>} {<100>})]
                )
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:cnt)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (word_part.ArithSub
                                anode: 
                                  (arith_expr.Binary
                                    op_id: Id.Arith_Plus
                                    left: {($ Id.VSub_DollarName '$cnt')}
                                    right: {<Id.Lit_Digits 1>}
                                  )
                              )
                            }
                          spids: [39]
                        )
                      ]
                    )
                    (command.Simple
                      words: [{<echo>} {(DQ ($ Id.VSub_Number '$2'))}]
                      redirects: [
                        (redir
                          op: <Id.Redir_DGreat '>>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {(DQ ($ Id.VSub_Number '$1'))}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                )
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\t# Ensure that file sizes are different, because on Windows\n'> 
          <'\t# lstat() does not discover inode numbers, and we need\n'> <'\t# other properties to discover swapped files\n'> 
          <'\t# (mtime is not always different, either).\n'> <'\tcreate_file file1 "some content" &&\n'> <'\tcreate_file file2 "some other content" &&\n'> 
          <'\tcreate_file file3 "again something else" &&\n'> <'\tgit add file1 file2 file3 &&\n'> <'\tgit commit -m 1\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'criss-cross rename'>)} 
      {
        (SQ <'\n'> <'\tmv file1 tmp &&\n'> <'\tmv file2 file1 &&\n'> <'\tmv tmp file2 &&\n'> 
          <'\tcp file1 file1-swapped &&\n'> <'\tcp file2 file2-swapped\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff -M -B'>)} 
      {(SQ <'\n'> <'\tgit diff -M -B > diff &&\n'> <'\tgit reset --hard\n'> <'\n'>)}
    )
    (C {<test_expect_success>} {(SQ <apply>)} 
      {
        (SQ <'\n'> <'\tgit apply diff &&\n'> <'\ttest_cmp file1 file1-swapped &&\n'> 
          <'\ttest_cmp file2 file2-swapped\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'criss-cross rename'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tmv file1 tmp &&\n'> <'\tmv file2 file1 &&\n'> 
          <'\tmv file3 file2 &&\n'> <'\tmv tmp file3 &&\n'> <'\tcp file1 file1-swapped &&\n'> <'\tcp file2 file2-swapped &&\n'> 
          <'\tcp file3 file3-swapped\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'diff -M -B'>)} 
      {(SQ <'\n'> <'\tgit diff -M -B > diff &&\n'> <'\tgit reset --hard\n'>)}
    )
    (C {<test_expect_success>} {(SQ <apply>)} 
      {
        (SQ <'\n'> <'\tgit apply diff &&\n'> <'\ttest_cmp file1 file1-swapped &&\n'> 
          <'\ttest_cmp file2 file2-swapped &&\n'> <'\ttest_cmp file3 file3-swapped\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)