(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"Break and then rename\n"> <"\n"> <"We have two very different files, file0 and file1, registered in a tree.\n"> <"\n"> <"We update file1 so drastically that it is more similar to file0, and\n"> <"then remove file0. With -B, changes to file1 should be broken into\n"> <"separate delete and create, resulting in removal of file0, removal of\n"> <"original file1 and creation of completely rewritten file1. The latter\n"> <"two are then merged back into a single \"complete rewrite\".\n"> <"\n"> <"Further, with -B and -M together, these three modifications should\n"> <"turn into rename-edit of file0 into file1.\n"> <"\n"> <"Starting from the same two files in the tree, we swap file0 and file1.\n"> <"With -B, this should be detected as two complete rewrites.\n"> <"\n"> <"Further, with -B and -M together, these should turn into two renames.\n"> ) } spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (Sentence child: (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/diff-lib.sh)}) terminator: <Op_Semi ";"> ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\tcat \"$TEST_DIRECTORY\"/diff-lib/README >file0 &&\n"> <"\tcat \"$TEST_DIRECTORY\"/diff-lib/COPYING >file1 &&\n"> <"\tgit update-index --add file0 file1 &&\n"> <"\tgit tag reference $(git write-tree)\n"> ) } ) (C {(test_expect_success)} {(SQ <"change file1 with copy-edit of file0 and remove file0">)} { (SQ <"\n"> <"\tsed -e \"s/git/GIT/\" file0 >file1 &&\n"> <"\trm -f file0 &&\n"> <"\tgit update-index --remove file0 file1\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B (#1)">)} { (SQ <"\n"> <"\tgit diff-index -B --cached reference >current &&\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D\tfile0\n" > < "\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100\tfile1\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B and -M (#2)">)} { (SQ <"\n"> <"\tgit diff-index -B -M reference >current &&\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec R100\tfile0\tfile1\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"swap file0 and file1">)} { (SQ <"\n"> <"\trm -f file0 file1 &&\n"> <"\tgit read-tree -m reference &&\n"> <"\tgit checkout-index -f -u -a &&\n"> <"\tmv file0 tmp &&\n"> <"\tmv file1 file0 &&\n"> <"\tmv tmp file1 &&\n"> <"\tgit update-index file0 file1\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B (#3)">)} { (SQ <"\n"> <"\tgit diff-index -B reference >current &&\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 6ff87c4664981e4397625791c8ea3bbb5f2279a3 M100\tfile0\n" > < "\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100\tfile1\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B and -M (#4)">)} { (SQ <"\n"> <"\tgit diff-index -B -M reference >current &&\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100\tfile1\tfile0\n" > < "\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 R100\tfile0\tfile1\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"make file0 into something completely different">)} { (SQ <"\n"> <"\trm -f file0 &&\n"> <"\ttest_ln_s_add frotz file0 &&\n"> <"\tgit update-index file1\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B (#5)">)} { (SQ <"\n"> <"\tgit diff-index -B reference >current &&\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T\tfile0\n" > < "\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M100\tfile1\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B -M (#6)">)} { (SQ <"\n"> <"\tgit diff-index -B -M reference >current &&\n"> <"\n"> <"\t# file0 changed from regular to symlink. file1 is the same as the preimage\n"> <"\t# of file0. Because the change does not make file0 disappear, file1 is\n"> <"\t# denoted as a copy of file0\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T\tfile0\n" > < "\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 548142c327a6790ff8821d67c2ee1eff7a656b52 C\tfile0\tfile1\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -M (#7)">)} { (SQ <"\n"> <"\tgit diff-index -M reference >current &&\n"> <"\n"> <"\t# This should not mistake file0 as the copy source of new file1\n"> <"\t# due to type differences.\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T\tfile0\n" > < "\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M\tfile1\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"file1 edited to look like file0 and file0 rename-edited to file2">)} { (SQ <"\n"> <"\trm -f file0 file1 &&\n"> <"\tgit read-tree -m reference &&\n"> <"\tgit checkout-index -f -u -a &&\n"> <"\tsed -e \"s/git/GIT/\" file0 >file1 &&\n"> <"\tsed -e \"s/git/GET/\" file0 >file2 &&\n"> <"\trm -f file0 &&\n"> <"\tgit update-index --add --remove file0 file1 file2\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B (#8)">)} { (SQ <"\n"> <"\tgit diff-index -B reference >current &&\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D\tfile0\n" > < "\t:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec M100\tfile1\n" > < "\t:000000 100644 0000000000000000000000000000000000000000 69a939f651686f56322566e2fd76715947a24162 A\tfile2\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_expect_success)} {(SQ <"run diff with -B -C (#9)">)} { (SQ <"\n"> <"\tgit diff-index -B -C reference >current &&\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 2fbedd0b5d4b8126e4750c3bee305e8ff79f80ec C095\tfile0\tfile1\n" > < "\t:100644 100644 548142c327a6790ff8821d67c2ee1eff7a656b52 69a939f651686f56322566e2fd76715947a24162 R095\tfile0\tfile2\n" > <"\tEOF\n"> <"\tcompare_diff_raw expect current\n"> ) } ) (C {(test_done)}) ] )