(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: { (SQ (Token id:Id.Lit_Chars val:'Break and then rename\n' span_id:15) (Token id:Id.Lit_Chars val:'\n' span_id:16) (Token id: Id.Lit_Chars val: 'We have two very different files, file0 and file1, registered in a tree.\n' span_id: 17 ) (Token id:Id.Lit_Chars val:'\n' span_id:18) (Token id: Id.Lit_Chars val: 'We update file1 so drastically that it is more similar to file0, and\n' span_id: 19 ) (Token id: Id.Lit_Chars val: 'then remove file0. With -B, changes to file1 should be broken into\n' span_id: 20 ) (Token id: Id.Lit_Chars val: 'separate delete and create, resulting in removal of file0, removal of\n' span_id: 21 ) (Token id: Id.Lit_Chars val: 'original file1 and creation of completely rewritten file1. The latter\n' span_id: 22 ) (Token id:Id.Lit_Chars val:'two are then merged back into a single "complete rewrite".\n' span_id:23) (Token id:Id.Lit_Chars val:'\n' span_id:24) (Token id: Id.Lit_Chars val: 'Further, with -B and -M together, these three modifications should\n' span_id: 25 ) (Token id:Id.Lit_Chars val:'turn into rename-edit of file0 into file1.\n' span_id:26) (Token id:Id.Lit_Chars val:'\n' span_id:27) (Token id: Id.Lit_Chars val: 'Starting from the same two files in the tree, we swap file0 and file1.\n' span_id: 28 ) (Token id:Id.Lit_Chars val:'With -B, this should be detected as two complete rewrites.\n' span_id:29) (Token id:Id.Lit_Chars val:'\n' span_id:30) (Token id: Id.Lit_Chars val: 'Further, with -B and -M together, these should turn into two renames.\n' span_id: 31 ) ) } spids: [13] ) ] ) (C {(.)} {(./test-lib.sh)}) (command.Sentence child: (C {(.)} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) (/diff-lib.sh)}) terminator: (Token id:Id.Op_Semi val:';' span_id:45) ) (C {(test_expect_success)} {(setup)} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:55) (Token id: Id.Lit_Chars val: '\tcat "$TEST_DIRECTORY"/diff-lib/README >file0 &&\n' span_id: 56 ) (Token id:Id.Lit_Chars val:'\tcat "$TEST_DIRECTORY"/diff-lib/COPYING >file1 &&\n' span_id:57) (Token id: Id.Lit_Chars val: '\tgit update-index --add file0 file1 &&\n' span_id: 58 ) (Token id:Id.Lit_Chars val:'\tgit tag reference $(git write-tree)\n' span_id:59) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'change file1 with copy-edit of file0 and remove file0' span_id: 66 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:70) (Token id:Id.Lit_Chars val:'\tsed -e "s/git/GIT/" file0 >file1 &&\n' span_id:71) (Token id:Id.Lit_Chars val:'\trm -f file0 &&\n' span_id:72) (Token id: Id.Lit_Chars val: '\tgit update-index --remove file0 file1\n' span_id: 73 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B (#1)' span_id:80))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:84) (Token id: Id.Lit_Chars val: '\tgit diff-index -B --cached reference >current &&\n' span_id: 85 ) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:86) (Token id: Id.Lit_Chars val: '\t:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D\tfile0\n' span_id: 87 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100\tfile1\n' span_id: 88 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:89) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:90) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B and -M (#2)' span_id:97))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:101) (Token id: Id.Lit_Chars val: '\tgit diff-index -B -M reference >current &&\n' span_id: 102 ) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:103) (Token id: Id.Lit_Chars val: '\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec R100\tfile0\tfile1\n' span_id: 104 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:105) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:106) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'swap file0 and file1' span_id:113))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:117) (Token id:Id.Lit_Chars val:'\trm -f file0 file1 &&\n' span_id:118) (Token id:Id.Lit_Chars val:'\tgit read-tree -m reference &&\n' span_id:119) (Token id:Id.Lit_Chars val:'\tgit checkout-index -f -u -a &&\n' span_id:120) (Token id:Id.Lit_Chars val:'\tmv file0 tmp &&\n' span_id:121) (Token id:Id.Lit_Chars val:'\tmv file1 file0 &&\n' span_id:122) (Token id:Id.Lit_Chars val:'\tmv tmp file1 &&\n' span_id:123) (Token id:Id.Lit_Chars val:'\tgit update-index file0 file1\n' span_id:124) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B (#3)' span_id:131))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:135) (Token id: Id.Lit_Chars val: '\tgit diff-index -B reference >current &&\n' span_id: 136 ) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:137) (Token id: Id.Lit_Chars val: '\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 6ff87c4664981e4397625791c8ea3bbb5f2279a3 M100\tfile0\n' span_id: 138 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100\tfile1\n' span_id: 139 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:140) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:141) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B and -M (#4)' span_id:148))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:152) (Token id: Id.Lit_Chars val: '\tgit diff-index -B -M reference >current &&\n' span_id: 153 ) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:154) (Token id: Id.Lit_Chars val: '\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100\tfile1\tfile0\n' span_id: 155 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 R100\tfile0\tfile1\n' span_id: 156 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:157) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:158) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'make file0 into something completely different' span_id:165))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:169) (Token id:Id.Lit_Chars val:'\trm -f file0 &&\n' span_id:170) (Token id:Id.Lit_Chars val:'\ttest_ln_s_add frotz file0 &&\n' span_id:171) (Token id:Id.Lit_Chars val:'\tgit update-index file1\n' span_id:172) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B (#5)' span_id:179))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:183) (Token id: Id.Lit_Chars val: '\tgit diff-index -B reference >current &&\n' span_id: 184 ) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:185) (Token id: Id.Lit_Chars val: '\t:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T\tfile0\n' span_id: 186 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100\tfile1\n' span_id: 187 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:188) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:189) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B -M (#6)' span_id:196))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:200) (Token id: Id.Lit_Chars val: '\tgit diff-index -B -M reference >current &&\n' span_id: 201 ) (Token id:Id.Lit_Chars val:'\n' span_id:202) (Token id: Id.Lit_Chars val: '\t# file0 changed from regular to symlink. file1 is the same as the preimage\n' span_id: 203 ) (Token id: Id.Lit_Chars val: '\t# of file0. Because the change does not make file0 disappear, file1 is\n' span_id: 204 ) (Token id:Id.Lit_Chars val:'\t# denoted as a copy of file0\n' span_id:205) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:206) (Token id: Id.Lit_Chars val: '\t:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T\tfile0\n' span_id: 207 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 C\tfile0\tfile1\n' span_id: 208 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:209) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:210) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -M (#7)' span_id:217))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:221) (Token id: Id.Lit_Chars val: '\tgit diff-index -M reference >current &&\n' span_id: 222 ) (Token id:Id.Lit_Chars val:'\n' span_id:223) (Token id: Id.Lit_Chars val: '\t# This should not mistake file0 as the copy source of new file1\n' span_id: 224 ) (Token id:Id.Lit_Chars val:'\t# due to type differences.\n' span_id:225) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:226) (Token id: Id.Lit_Chars val: '\t:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T\tfile0\n' span_id: 227 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M\tfile1\n' span_id: 228 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:229) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:230) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'file1 edited to look like file0 and file0 rename-edited to file2' span_id: 237 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:241) (Token id:Id.Lit_Chars val:'\trm -f file0 file1 &&\n' span_id:242) (Token id:Id.Lit_Chars val:'\tgit read-tree -m reference &&\n' span_id:243) (Token id:Id.Lit_Chars val:'\tgit checkout-index -f -u -a &&\n' span_id:244) (Token id:Id.Lit_Chars val:'\tsed -e "s/git/GIT/" file0 >file1 &&\n' span_id:245) (Token id:Id.Lit_Chars val:'\tsed -e "s/git/GET/" file0 >file2 &&\n' span_id:246) (Token id:Id.Lit_Chars val:'\trm -f file0 &&\n' span_id:247) (Token id: Id.Lit_Chars val: '\tgit update-index --add --remove file0 file1 file2\n' span_id: 248 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B (#8)' span_id:255))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:259) (Token id: Id.Lit_Chars val: '\tgit diff-index -B reference >current &&\n' span_id: 260 ) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:261) (Token id: Id.Lit_Chars val: '\t:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D\tfile0\n' span_id: 262 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100\tfile1\n' span_id: 263 ) (Token id: Id.Lit_Chars val: '\t:000000 100644 0000000000000000000000000000000000000000 69a939f651686f56322566e2fd76715947a24162 A\tfile2\n' span_id: 264 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:265) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:266) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'run diff with -B -C (#9)' span_id:273))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:277) (Token id: Id.Lit_Chars val: '\tgit diff-index -B -C reference >current &&\n' span_id: 278 ) (Token id:Id.Lit_Chars val:'\tcat >expect <<-\\EOF &&\n' span_id:279) (Token id: Id.Lit_Chars val: '\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec C095\tfile0\tfile1\n' span_id: 280 ) (Token id: Id.Lit_Chars val: '\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 69a939f651686f56322566e2fd76715947a24162 R095\tfile0\tfile2\n' span_id: 281 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:282) (Token id:Id.Lit_Chars val:'\tcompare_diff_raw expect current\n' span_id:283) ) } ) (C {(test_done)}) ] )