(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Merge-recursive merging renames">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: modify body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(sed)} {(-e)} {(DQ ($ VSub_Number "$1"))}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Number "$2"))} spids: [30] ) (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Number "$2") (.x))} spids: [35] ) ] ) (C {(mv)} {(DQ ($ VSub_Number "$2") (.x))} {(DQ ($ VSub_Number "$2"))}) ] op_id: Op_DAmp ) ] spids: [19] ) spids: [14 18] ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"cat >A <<\\EOF &&\n"> <"a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"> <"b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"> <"c cccccccccccccccccccccccccccccccccccccccccccccccc\n"> <"d dddddddddddddddddddddddddddddddddddddddddddddddd\n"> <"e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\n"> <"f ffffffffffffffffffffffffffffffffffffffffffffffff\n"> <"g gggggggggggggggggggggggggggggggggggggggggggggggg\n"> <"h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n"> <"i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\n"> <"j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj\n"> <"k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk\n"> <"l llllllllllllllllllllllllllllllllllllllllllllllll\n"> <"m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm\n"> <"n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn\n"> <"o oooooooooooooooooooooooooooooooooooooooooooooooo\n"> <"EOF\n"> <"\n"> <"cat >M <<\\EOF &&\n"> <"A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"> <"B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n"> <"C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n"> <"D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\n"> <"E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n"> <"F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n"> <"G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG\n"> <"H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\n"> <"I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\n"> <"J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ\n"> <"K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK\n"> <"L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL\n"> <"M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n"> <"N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN\n"> <"O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\n"> <"EOF\n"> <"\n"> <"git add A M &&\n"> <"git commit -m \"initial has A and M\" &&\n"> <"git branch white &&\n"> <"git branch red &&\n"> <"git branch blue &&\n"> <"git branch yellow &&\n"> <"git branch change &&\n"> <"git branch change+rename &&\n"> <"\n"> <"sed -e \"/^g /s/.*/g : master changes a line/\" <A >A+ &&\n"> <"mv A+ A &&\n"> <"git commit -a -m \"master updates A\" &&\n"> <"\n"> <"git checkout yellow &&\n"> <"rm -f M &&\n"> <"git commit -a -m \"yellow removes M\" &&\n"> <"\n"> <"git checkout white &&\n"> <"sed -e \"/^g /s/.*/g : white changes a line/\" <A >B &&\n"> <"sed -e \"/^G /s/.*/G : colored branch changes a line/\" <M >N &&\n"> <"rm -f A M &&\n"> <"git update-index --add --remove A B M N &&\n"> <"git commit -m \"white renames A->B, M->N\" &&\n"> <"\n"> <"git checkout red &&\n"> <"sed -e \"/^g /s/.*/g : red changes a line/\" <A >B &&\n"> <"sed -e \"/^G /s/.*/G : colored branch changes a line/\" <M >N &&\n"> <"rm -f A M &&\n"> <"git update-index --add --remove A B M N &&\n"> <"git commit -m \"red renames A->B, M->N\" &&\n"> <"\n"> <"git checkout blue &&\n"> <"sed -e \"/^g /s/.*/g : blue changes a line/\" <A >C &&\n"> <"sed -e \"/^G /s/.*/G : colored branch changes a line/\" <M >N &&\n"> <"rm -f A M &&\n"> <"git update-index --add --remove A C M N &&\n"> <"git commit -m \"blue renames A->C, M->N\" &&\n"> <"\n"> <"git checkout change &&\n"> <"sed -e \"/^g /s/.*/g : changed line/\" <A >A+ &&\n"> <"mv A+ A &&\n"> <"git commit -q -a -m \"changed\" &&\n"> <"\n"> <"git checkout change+rename &&\n"> <"sed -e \"/^g /s/.*/g : changed line/\" <A >B &&\n"> <"rm A &&\n"> <"git update-index --add B &&\n"> <"git commit -q -a -m \"changed and renamed\" &&\n"> <"\n"> <"git checkout master"> ) } ) (C {(test_expect_success)} {(SQ <"pull renaming branch into unrenaming one">)} { (SQ <"\n"> <"\tgit show-branch &&\n"> <"\ttest_expect_code 1 git pull . white &&\n"> <"\tgit ls-files -s &&\n"> <"\tgit ls-files -u B >b.stages &&\n"> <"\ttest_line_count = 3 b.stages &&\n"> <"\tgit ls-files -s N >n.stages &&\n"> <"\ttest_line_count = 1 n.stages &&\n"> <"\tsed -ne \"/^g/{\n"> <"\tp\n"> <"\tq\n"> <"\t}\" B | grep master &&\n"> <"\tgit diff --exit-code white N\n"> ) } ) (C {(test_expect_success)} {(SQ <"pull renaming branch into another renaming one">)} { (SQ <"\n"> <"\trm -f B &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout red &&\n"> <"\ttest_expect_code 1 git pull . white &&\n"> <"\tgit ls-files -u B >b.stages &&\n"> <"\ttest_line_count = 3 b.stages &&\n"> <"\tgit ls-files -s N >n.stages &&\n"> <"\ttest_line_count = 1 n.stages &&\n"> <"\tsed -ne \"/^g/{\n"> <"\tp\n"> <"\tq\n"> <"\t}\" B | grep red &&\n"> <"\tgit diff --exit-code white N\n"> ) } ) (C {(test_expect_success)} {(SQ <"pull unrenaming branch into renaming one">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit show-branch &&\n"> <"\ttest_expect_code 1 git pull . master &&\n"> <"\tgit ls-files -u B >b.stages &&\n"> <"\ttest_line_count = 3 b.stages &&\n"> <"\tgit ls-files -s N >n.stages &&\n"> <"\ttest_line_count = 1 n.stages &&\n"> <"\tsed -ne \"/^g/{\n"> <"\tp\n"> <"\tq\n"> <"\t}\" B | grep red &&\n"> <"\tgit diff --exit-code white N\n"> ) } ) (C {(test_expect_success)} {(SQ <"pull conflicting renames">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit show-branch &&\n"> <"\ttest_expect_code 1 git pull . blue &&\n"> <"\tgit ls-files -u A >a.stages &&\n"> <"\ttest_line_count = 1 a.stages &&\n"> <"\tgit ls-files -u B >b.stages &&\n"> <"\ttest_line_count = 1 b.stages &&\n"> <"\tgit ls-files -u C >c.stages &&\n"> <"\ttest_line_count = 1 c.stages &&\n"> <"\tgit ls-files -s N >n.stages &&\n"> <"\ttest_line_count = 1 n.stages &&\n"> <"\tsed -ne \"/^g/{\n"> <"\tp\n"> <"\tq\n"> <"\t}\" B | grep red &&\n"> <"\tgit diff --exit-code white N\n"> ) } ) (C {(test_expect_success)} {(SQ <"interference with untracked working tree file">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit show-branch &&\n"> <"\techo >A this file should not matter &&\n"> <"\ttest_expect_code 1 git pull . white &&\n"> <"\ttest_path_is_file A\n"> ) } ) (C {(test_expect_success)} {(SQ <"interference with untracked working tree file">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout white &&\n"> <"\tgit show-branch &&\n"> <"\trm -f A &&\n"> <"\techo >A this file should not matter &&\n"> <"\ttest_expect_code 1 git pull . red &&\n"> <"\ttest_path_is_file A\n"> ) } ) (C {(test_expect_success)} {(SQ <"interference with untracked working tree file">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -f A M &&\n"> <"\tgit checkout -f master &&\n"> <"\tgit tag -f anchor &&\n"> <"\tgit show-branch &&\n"> <"\tgit pull . yellow &&\n"> <"\ttest_path_is_missing M &&\n"> <"\tgit reset --hard anchor\n"> ) } ) (C {(test_expect_success)} {(SQ <"updated working tree file should prevent the merge">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -f A M &&\n"> <"\tgit checkout -f master &&\n"> <"\tgit tag -f anchor &&\n"> <"\tgit show-branch &&\n"> <"\techo >>M one line addition &&\n"> <"\tcat M >M.saved &&\n"> <"\ttest_expect_code 128 git pull . yellow &&\n"> <"\ttest_cmp M M.saved &&\n"> <"\trm -f M.saved\n"> ) } ) (C {(test_expect_success)} {(SQ <"updated working tree file should prevent the merge">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -f A M &&\n"> <"\tgit checkout -f master &&\n"> <"\tgit tag -f anchor &&\n"> <"\tgit show-branch &&\n"> <"\techo >>M one line addition &&\n"> <"\tcat M >M.saved &&\n"> <"\tgit update-index M &&\n"> <"\ttest_expect_code 128 git pull . yellow &&\n"> <"\ttest_cmp M M.saved &&\n"> <"\trm -f M.saved\n"> ) } ) (C {(test_expect_success)} {(SQ <"interference with untracked working tree file">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -f A M &&\n"> <"\tgit checkout -f yellow &&\n"> <"\tgit tag -f anchor &&\n"> <"\tgit show-branch &&\n"> <"\techo >M this file should not matter &&\n"> <"\tgit pull . master &&\n"> <"\ttest_path_is_file M &&\n"> <"\t! {\n"> <"\t\tgit ls-files -s |\n"> <"\t\tgrep M\n"> <"\t} &&\n"> <"\tgit reset --hard anchor\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge of identical changes in a renamed file">)} { (SQ <"\n"> <"\trm -f A M N &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout change+rename &&\n"> <"\tGIT_MERGE_VERBOSITY=3 git merge change | test_i18ngrep \"^Skipped B\" &&\n"> <"\tgit reset --hard HEAD^ &&\n"> <"\tgit checkout change &&\n"> <"\tGIT_MERGE_VERBOSITY=3 git merge change+rename | test_i18ngrep \"^Skipped B\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup for rename + d/f conflicts">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan dir-in-way &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\tmkdir sub &&\n"> <"\tmkdir dir &&\n"> <"\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" >sub/file &&\n"> <"\techo foo >dir/file-in-the-way &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Common commit\" &&\n"> <"\n"> <"\techo 11 >>sub/file &&\n"> <"\techo more >>dir/file-in-the-way &&\n"> <"\tgit add -u &&\n"> <"\tgit commit -m \"Commit to merge, with dir in the way\" &&\n"> <"\n"> <"\tgit checkout -b dir-not-in-way &&\n"> <"\tgit reset --soft HEAD^ &&\n"> <"\tgit rm -rf dir &&\n"> <"\tgit commit -m \"Commit to merge, with dir removed\" -- dir sub/file &&\n"> <"\n"> <"\tgit checkout -b renamed-file-has-no-conflicts dir-in-way~1 &&\n"> <"\tgit rm -rf dir &&\n"> <"\tgit rm sub/file &&\n"> <"\tprintf \"1\\n2\\n3\\n4\\n5555\\n6\\n7\\n8\\n9\\n10\\n\" >dir &&\n"> <"\tgit add dir &&\n"> <"\tgit commit -m \"Independent change\" &&\n"> <"\n"> <"\tgit checkout -b renamed-file-has-conflicts dir-in-way~1 &&\n"> <"\tgit rm -rf dir &&\n"> <"\tgit mv sub/file dir &&\n"> <"\techo 12 >>dir &&\n"> <"\tgit add dir &&\n"> <"\tgit commit -m \"Conflicting change\"\n"> ) } ) (SimpleCommand words: [ {(printf)} { (DQ (1) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (2) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (3) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (4) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (5555) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (6) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (7) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (8) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (9) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (10) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (11) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) ) } ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[466])] ) (C {(test_expect_success)} {(SQ <"Rename+D/F conflict; renamed file merges + dir not in way">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout -q renamed-file-has-no-conflicts^0 &&\n"> <"\tgit merge --strategy=recursive dir-not-in-way &&\n"> <"\tgit diff --quiet &&\n"> <"\ttest -f dir &&\n"> <"\ttest_cmp expected dir\n"> ) } ) (C {(test_expect_success)} {(SQ <"Rename+D/F conflict; renamed file merges but dir in way">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -rf dir~* &&\n"> <"\tgit checkout -q renamed-file-has-no-conflicts^0 &&\n"> <"\ttest_must_fail git merge --strategy=recursive dir-in-way >output &&\n"> <"\n"> <"\ttest_i18ngrep \"CONFLICT (modify/delete): dir/file-in-the-way\" output &&\n"> <"\ttest_i18ngrep \"Auto-merging dir\" output &&\n"> <"\ttest_i18ngrep \"Adding as dir~HEAD instead\" output &&\n"> <"\n"> <"\ttest 3 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 2 -eq \"$(git ls-files -u dir/file-in-the-way | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\ttest_must_fail git diff --cached --quiet &&\n"> <"\n"> <"\ttest -f dir/file-in-the-way &&\n"> <"\ttest -f dir~HEAD &&\n"> <"\ttest_cmp expected dir~HEAD\n"> ) } ) (C {(test_expect_success)} {(SQ <"Same as previous, but merged other way">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -rf dir~* &&\n"> <"\tgit checkout -q dir-in-way^0 &&\n"> < "\ttest_must_fail git merge --strategy=recursive renamed-file-has-no-conflicts >output 2>errors &&\n" > <"\n"> <"\t! grep \"error: refusing to lose untracked file at\" errors &&\n"> <"\ttest_i18ngrep \"CONFLICT (modify/delete): dir/file-in-the-way\" output &&\n"> <"\ttest_i18ngrep \"Auto-merging dir\" output &&\n"> <"\ttest_i18ngrep \"Adding as dir~renamed-file-has-no-conflicts instead\" output &&\n"> <"\n"> <"\ttest 3 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 2 -eq \"$(git ls-files -u dir/file-in-the-way | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\ttest_must_fail git diff --cached --quiet &&\n"> <"\n"> <"\ttest -f dir/file-in-the-way &&\n"> <"\ttest -f dir~renamed-file-has-no-conflicts &&\n"> <"\ttest_cmp expected dir~renamed-file-has-no-conflicts\n"> ) } ) (AndOr children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[548]) (HereDoc op_id: Redir_DLess fd: -1 body: {("1\n") ("2\n") ("3\n") ("4\n") ("5\n") ("6\n") ("7\n") ("8\n") ("9\n") ("10\n") ("<<<<<<< HEAD:dir\n") ("12\n") ("=======\n") ("11\n") (">>>>>>> dir-not-in-way:sub/file\n") } do_expansion: False here_end: EOF was_filled: True spids: [551] ) ] ) (C {(test_expect_success)} {(SQ <"Rename+D/F conflict; renamed file cannot merge, dir not in way">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -rf dir~* &&\n"> <"\tgit checkout -q renamed-file-has-conflicts^0 &&\n"> <"\ttest_must_fail git merge --strategy=recursive dir-not-in-way &&\n"> <"\n"> <"\ttest 3 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 3 -eq \"$(git ls-files -u dir | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\ttest_must_fail git diff --cached --quiet &&\n"> <"\n"> <"\ttest -f dir &&\n"> <"\ttest_cmp expected dir\n"> ) } ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"Rename+D/F conflict; renamed file cannot merge and dir in the way">)} { (SQ <"\n"> <"\tmodify s/dir-not-in-way/dir-in-way/ expected &&\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\trm -rf dir~* &&\n"> <"\tgit checkout -q renamed-file-has-conflicts^0 &&\n"> <"\ttest_must_fail git merge --strategy=recursive dir-in-way &&\n"> <"\n"> <"\ttest 5 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 3 -eq \"$(git ls-files -u dir | grep -v file-in-the-way | wc -l)\" &&\n"> <"\ttest 2 -eq \"$(git ls-files -u dir/file-in-the-way | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\ttest_must_fail git diff --cached --quiet &&\n"> <"\n"> <"\ttest -f dir/file-in-the-way &&\n"> <"\ttest -f dir~HEAD &&\n"> <"\ttest_cmp expected dir~HEAD\n"> ) } ) (AndOr children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[612]) (HereDoc op_id: Redir_DLess fd: -1 body: {("1\n") ("2\n") ("3\n") ("4\n") ("5\n") ("6\n") ("7\n") ("8\n") ("9\n") ("10\n") ("<<<<<<< HEAD:sub/file\n") ("11\n") ("=======\n") ("12\n") (">>>>>>> renamed-file-has-conflicts:dir\n") } do_expansion: False here_end: EOF was_filled: True spids: [615] ) ] ) (C {(test_expect_success)} {(SQ <"Same as previous, but merged other way">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -rf dir~* &&\n"> <"\tgit checkout -q dir-in-way^0 &&\n"> <"\ttest_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&\n"> <"\n"> <"\ttest 5 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 3 -eq \"$(git ls-files -u dir | grep -v file-in-the-way | wc -l)\" &&\n"> <"\ttest 2 -eq \"$(git ls-files -u dir/file-in-the-way | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\ttest_must_fail git diff --cached --quiet &&\n"> <"\n"> <"\ttest -f dir/file-in-the-way &&\n"> <"\ttest -f dir~renamed-file-has-conflicts &&\n"> <"\ttest_cmp expected dir~renamed-file-has-conflicts\n"> ) } ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"setup both rename source and destination involved in D/F conflict">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan rename-dest &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\tmkdir one &&\n"> <"\techo stuff >one/file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Common commit\" &&\n"> <"\n"> <"\tgit mv one/file destdir &&\n"> <"\tgit commit -m \"Renamed to destdir\" &&\n"> <"\n"> <"\tgit checkout -b source-conflict HEAD~1 &&\n"> <"\tgit rm -rf one &&\n"> <"\tmkdir destdir &&\n"> <"\ttouch one destdir/foo &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Conflicts in the way\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"both rename source and destination involved in D/F conflict">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\trm -rf dir~* &&\n"> <"\tgit checkout -q rename-dest^0 &&\n"> <"\ttest_must_fail git merge --strategy=recursive source-conflict &&\n"> <"\n"> <"\ttest 1 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\n"> <"\ttest -f destdir/foo &&\n"> <"\ttest -f one &&\n"> <"\ttest -f destdir~HEAD &&\n"> <"\ttest \"stuff\" = \"$(cat destdir~HEAD)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup pair rename to parent of other (D/F conflicts)">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan rename-two &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\tmkdir one &&\n"> <"\tmkdir two &&\n"> <"\techo stuff >one/file &&\n"> <"\techo other >two/file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Common commit\" &&\n"> <"\n"> <"\tgit rm -rf one &&\n"> <"\tgit mv two/file one &&\n"> <"\tgit commit -m \"Rename two/file -> one\" &&\n"> <"\n"> <"\tgit checkout -b rename-one HEAD~1 &&\n"> <"\tgit rm -rf two &&\n"> <"\tgit mv one/file two &&\n"> <"\trm -r one &&\n"> <"\tgit commit -m \"Rename one/file -> two\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"pair rename to parent of other (D/F conflicts) w/ untracked dir">)} { (SQ <"\n"> <"\tgit checkout -q rename-one^0 &&\n"> <"\tmkdir one &&\n"> <"\ttest_must_fail git merge --strategy=recursive rename-two &&\n"> <"\n"> <"\ttest 2 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u one | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u two | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\n"> <"\ttest 4 -eq $(find . | grep -v .git | wc -l) &&\n"> <"\n"> <"\ttest -d one &&\n"> <"\ttest -f one~rename-two &&\n"> <"\ttest -f two &&\n"> <"\ttest \"other\" = $(cat one~rename-two) &&\n"> <"\ttest \"stuff\" = $(cat two)\n"> ) } ) (C {(test_expect_success)} {(SQ <"pair rename to parent of other (D/F conflicts) w/ clean start">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit clean -fdqx &&\n"> <"\ttest_must_fail git merge --strategy=recursive rename-two &&\n"> <"\n"> <"\ttest 2 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u one | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u two | wc -l)\" &&\n"> <"\n"> <"\ttest_must_fail git diff --quiet &&\n"> <"\n"> <"\ttest 3 -eq $(find . | grep -v .git | wc -l) &&\n"> <"\n"> <"\ttest -f one &&\n"> <"\ttest -f two &&\n"> <"\ttest \"other\" = $(cat one) &&\n"> <"\ttest \"stuff\" = $(cat two)\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup rename of one file to two, with directories in the way">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan first-rename &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\techo stuff >original &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Common commit\" &&\n"> <"\n"> <"\tmkdir two &&\n"> <"\t>two/file &&\n"> <"\tgit add two/file &&\n"> <"\tgit mv original one &&\n"> <"\tgit commit -m \"Put two/file in the way, rename to one\" &&\n"> <"\n"> <"\tgit checkout -b second-rename HEAD~1 &&\n"> <"\tmkdir one &&\n"> <"\t>one/file &&\n"> <"\tgit add one/file &&\n"> <"\tgit mv original two &&\n"> <"\tgit commit -m \"Put one/file in the way, rename to two\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"check handling of differently renamed file with D/F conflicts">)} { (SQ <"\n"> <"\tgit checkout -q first-rename^0 &&\n"> <"\ttest_must_fail git merge --strategy=recursive second-rename &&\n"> <"\n"> <"\ttest 5 -eq \"$(git ls-files -s | wc -l)\" &&\n"> <"\ttest 3 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u one | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u two | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u original | wc -l)\" &&\n"> <"\ttest 2 -eq \"$(git ls-files -o | wc -l)\" &&\n"> <"\n"> <"\ttest -f one/file &&\n"> <"\ttest -f two/file &&\n"> <"\ttest -f one~HEAD &&\n"> <"\ttest -f two~second-rename &&\n"> <"\t! test -f original\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup rename one file to two; directories moving out of the way">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan first-rename-redo &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\techo stuff >original &&\n"> <"\tmkdir one two &&\n"> <"\ttouch one/file two/file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Common commit\" &&\n"> <"\n"> <"\tgit rm -rf one &&\n"> <"\tgit mv original one &&\n"> <"\tgit commit -m \"Rename to one\" &&\n"> <"\n"> <"\tgit checkout -b second-rename-redo HEAD~1 &&\n"> <"\tgit rm -rf two &&\n"> <"\tgit mv original two &&\n"> <"\tgit commit -m \"Rename to two\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"check handling of differently renamed file with D/F conflicts">)} { (SQ <"\n"> <"\tgit checkout -q first-rename-redo^0 &&\n"> <"\ttest_must_fail git merge --strategy=recursive second-rename-redo &&\n"> <"\n"> <"\ttest 3 -eq \"$(git ls-files -u | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u one | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u two | wc -l)\" &&\n"> <"\ttest 1 -eq \"$(git ls-files -u original | wc -l)\" &&\n"> <"\ttest 0 -eq \"$(git ls-files -o | wc -l)\" &&\n"> <"\n"> <"\ttest -f one &&\n"> <"\ttest -f two &&\n"> <"\t! test -f original\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup avoid unnecessary update, normal rename">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan avoid-unnecessary-update-1 &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" >original &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Common commit\" &&\n"> <"\n"> <"\tgit mv original rename &&\n"> <"\techo 11 >>rename &&\n"> <"\tgit add -u &&\n"> <"\tgit commit -m \"Renamed and modified\" &&\n"> <"\n"> <"\tgit checkout -b merge-branch-1 HEAD~1 &&\n"> <"\techo \"random content\" >random-file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Random, unrelated changes\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"avoid unnecessary update, normal rename">)} { (SQ <"\n"> <"\tgit checkout -q avoid-unnecessary-update-1^0 &&\n"> <"\ttest-chmtime =1000000000 rename &&\n"> <"\ttest-chmtime -v +0 rename >expect &&\n"> <"\tgit merge merge-branch-1 &&\n"> <"\ttest-chmtime -v +0 rename >actual &&\n"> <"\ttest_cmp expect actual # \"rename\" should have stayed intact\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup to test avoiding unnecessary update, with D/F conflict">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan avoid-unnecessary-update-2 &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\tmkdir df &&\n"> <"\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" >df/file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Common commit\" &&\n"> <"\n"> <"\tgit mv df/file temp &&\n"> <"\trm -rf df &&\n"> <"\tgit mv temp df &&\n"> <"\techo 11 >>df &&\n"> <"\tgit add -u &&\n"> <"\tgit commit -m \"Renamed and modified\" &&\n"> <"\n"> <"\tgit checkout -b merge-branch-2 HEAD~1 &&\n"> <"\t>unrelated-change &&\n"> <"\tgit add unrelated-change &&\n"> <"\tgit commit -m \"Only unrelated changes\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"avoid unnecessary update, with D/F conflict">)} { (SQ <"\n"> <"\tgit checkout -q avoid-unnecessary-update-2^0 &&\n"> <"\ttest-chmtime =1000000000 df &&\n"> <"\ttest-chmtime -v +0 df >expect &&\n"> <"\tgit merge merge-branch-2 &&\n"> <"\ttest-chmtime -v +0 df >actual &&\n"> <"\ttest_cmp expect actual # \"df\" should have stayed intact\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup avoid unnecessary update, dir->(file,nothing)">)} { (SQ <"\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\trm -rf .git &&\n"> <"\tgit init &&\n"> <"\n"> <"\t>irrelevant &&\n"> <"\tmkdir df &&\n"> <"\t>df/file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -mA &&\n"> <"\n"> <"\tgit checkout -b side &&\n"> <"\tgit rm -rf df &&\n"> <"\tgit commit -mB &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\tgit rm -rf df &&\n"> <"\techo bla >df &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Add a newfile\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"avoid unnecessary update, dir->(file,nothing)">)} { (SQ <"\n"> <"\tgit checkout -q master^0 &&\n"> <"\ttest-chmtime =1000000000 df &&\n"> <"\ttest-chmtime -v +0 df >expect &&\n"> <"\tgit merge side &&\n"> <"\ttest-chmtime -v +0 df >actual &&\n"> <"\ttest_cmp expect actual # \"df\" should have stayed intact\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup avoid unnecessary update, modify/delete">)} { (SQ <"\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\trm -rf .git &&\n"> <"\tgit init &&\n"> <"\n"> <"\t>irrelevant &&\n"> <"\t>file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -mA &&\n"> <"\n"> <"\tgit checkout -b side &&\n"> <"\tgit rm -f file &&\n"> <"\tgit commit -m \"Delete file\" &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\techo bla >file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Modify file\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"avoid unnecessary update, modify/delete">)} { (SQ <"\n"> <"\tgit checkout -q master^0 &&\n"> <"\ttest-chmtime =1000000000 file &&\n"> <"\ttest-chmtime -v +0 file >expect &&\n"> <"\ttest_must_fail git merge side &&\n"> <"\ttest-chmtime -v +0 file >actual &&\n"> <"\ttest_cmp expect actual # \"file\" should have stayed intact\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup avoid unnecessary update, rename/add-dest">)} { (SQ <"\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\trm -rf .git &&\n"> <"\tgit init &&\n"> <"\n"> <"\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n\" >file &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -mA &&\n"> <"\n"> <"\tgit checkout -b side &&\n"> <"\tcp file newfile &&\n"> <"\tgit add -A &&\n"> <"\tgit commit -m \"Add file copy\" &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\tgit mv file newfile &&\n"> <"\tgit commit -m \"Rename file\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"avoid unnecessary update, rename/add-dest">)} { (SQ <"\n"> <"\tgit checkout -q master^0 &&\n"> <"\ttest-chmtime =1000000000 newfile &&\n"> <"\ttest-chmtime -v +0 newfile >expect &&\n"> <"\tgit merge side &&\n"> <"\ttest-chmtime -v +0 newfile >actual &&\n"> <"\ttest_cmp expect actual # \"file\" should have stayed intact\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup merge of rename + small change">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout --orphan rename-plus-small-change &&\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\n"> <"\techo ORIGINAL >file &&\n"> <"\tgit add file &&\n"> <"\n"> <"\ttest_tick &&\n"> <"\tgit commit -m Initial &&\n"> <"\tgit checkout -b rename_branch &&\n"> <"\tgit mv file renamed_file &&\n"> <"\tgit commit -m Rename &&\n"> <"\tgit checkout rename-plus-small-change &&\n"> <"\techo NEW-VERSION >file &&\n"> <"\tgit commit -a -m Reformat\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge rename + small change">)} { (SQ <"\n"> <"\tgit merge rename_branch &&\n"> <"\n"> <"\ttest 1 -eq $(git ls-files -s | wc -l) &&\n"> <"\ttest 0 -eq $(git ls-files -o | wc -l) &&\n"> <"\ttest $(git rev-parse HEAD:renamed_file) = $(git rev-parse HEAD~1:file)\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup for use of extended merge markers">)} { (SQ <"\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\trm -rf .git &&\n"> <"\tgit init &&\n"> <"\n"> <"\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n\" >original_file &&\n"> <"\tgit add original_file &&\n"> <"\tgit commit -mA &&\n"> <"\n"> <"\tgit checkout -b rename &&\n"> <"\techo 9 >>original_file &&\n"> <"\tgit add original_file &&\n"> <"\tgit mv original_file renamed_file &&\n"> <"\tgit commit -mB &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\techo 8.5 >>original_file &&\n"> <"\tgit add original_file &&\n"> <"\tgit commit -mC\n"> ) } ) (AndOr children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1209]) (HereDoc op_id: Redir_DLess fd: -1 body: {("1\n") ("2\n") ("3\n") ("4\n") ("5\n") ("6\n") ("7\n") ("8\n") ("<<<<<<< HEAD:renamed_file\n") ("9\n") ("=======\n") ("8.5\n") (">>>>>>> master^0:original_file\n") } do_expansion: False here_end: EOF was_filled: True spids: [1212] ) ] ) (C {(test_expect_success)} {(SQ <"merge master into rename has correct extended markers">)} { (SQ <"\n"> <"\tgit checkout rename^0 &&\n"> <"\ttest_must_fail git merge -s recursive master^0 &&\n"> <"\ttest_cmp expected renamed_file\n"> ) } ) ] op_id: Op_DAmp ) (AndOr children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1235]) (HereDoc op_id: Redir_DLess fd: -1 body: {("1\n") ("2\n") ("3\n") ("4\n") ("5\n") ("6\n") ("7\n") ("8\n") ("<<<<<<< HEAD:original_file\n") ("8.5\n") ("=======\n") ("9\n") (">>>>>>> rename^0:renamed_file\n") } do_expansion: False here_end: EOF was_filled: True spids: [1238] ) ] ) (C {(test_expect_success)} {(SQ <"merge rename into master has correct extended markers">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout master^0 &&\n"> <"\ttest_must_fail git merge -s recursive rename^0 &&\n"> <"\ttest_cmp expected renamed_file\n"> ) } ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"setup spurious \"refusing to lose untracked\" message">)} { (SQ <"\n"> <"\tgit rm -rf . &&\n"> <"\tgit clean -fdqx &&\n"> <"\trm -rf .git &&\n"> <"\tgit init &&\n"> <"\n"> <"\t> irrelevant_file &&\n"> <"\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n\" >original_file &&\n"> <"\tgit add irrelevant_file original_file &&\n"> <"\tgit commit -mA &&\n"> <"\n"> <"\tgit checkout -b rename &&\n"> <"\tgit mv original_file renamed_file &&\n"> <"\tgit commit -mB &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\tgit rm original_file &&\n"> <"\tgit commit -mC\n"> ) } ) (C {(test_expect_success)} {(SQ <"no spurious \"refusing to lose untracked\" message">)} { (SQ <"\n"> <"\tgit checkout master^0 &&\n"> <"\ttest_must_fail git merge rename^0 2>errors.txt &&\n"> <"\t! grep \"refusing to lose untracked file\" errors.txt\n"> ) } ) (C {(test_expect_success)} {(SQ <"do not follow renames for empty files">)} { (SQ <"\n"> <"\tgit checkout -f -b empty-base &&\n"> <"\t>empty1 &&\n"> <"\tgit add empty1 &&\n"> <"\tgit commit -m base &&\n"> <"\techo content >empty1 &&\n"> <"\tgit add empty1 &&\n"> <"\tgit commit -m fill &&\n"> <"\tgit checkout -b empty-topic HEAD^ &&\n"> <"\tgit mv empty1 empty2 &&\n"> <"\tgit commit -m rename &&\n"> <"\ttest_must_fail git merge empty-base &&\n"> <"\t>expect &&\n"> <"\ttest_cmp expect empty2\n"> ) } ) (C {(test_done)}) ] )