(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'git apply handling criss-cross rename patch.'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: create_file body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cnt) op:Equal rhs:{(0)} spids:[21])] spids: [21] ) (While cond: [(C {(test)} {($ VSub_Name '$cnt')} {(-le)} {(100)})] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cnt) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$cnt')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [40 47] ) } spids: [39] ) ] spids: [39] ) (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$2'))}] redirects: [ (Redir op_id: Redir_DGreat fd: 16777215 arg_word: {(DQ ($ VSub_Number '$1'))} spids: [56] ) ] ) ] spids: [36 63] ) ) ] spids: [18] ) spids: [14 17] ) (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)}) ] )