(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'git apply handling criss-cross rename patch.'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: create_file body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:cnt) op:Equal rhs:{(0)})] ) (command.WhileUntil keyword: <KW_While while> cond: [(C {(test)} {($ VSub_DollarName '$cnt')} {(-le)} {(100)})] body: (command.DoGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cnt) op: Equal rhs: { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithWord w:{($ VSub_DollarName '$cnt')}) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) } ) ] ) (command.SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$2'))}] redirects: [ (redir.Redir op: <Redir_DGreat '>>'> fd: 16777215 arg_word: {(DQ ($ VSub_Number '$1'))} ) ] ) ] ) ) ] ) ) (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)}) ] )