(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'read-tree -m -u checks working tree files'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-read-tree.sh'>}) (C {<test_expect_success>} {(SQ <'two-way setup'>)} { (SQ <'\n'> <'\n'> <'\tmkdir subdir &&\n'> <'\techo >file1 file one &&\n'> <'\techo >file2 file two &&\n'> <'\techo >subdir/file1 file one in subdirectory &&\n'> <'\techo >subdir/file2 file two in subdirectory &&\n'> <'\tgit update-index --add file1 file2 subdir/file1 subdir/file2 &&\n'> <'\tgit commit -m initial &&\n'> <'\n'> <'\tgit branch side &&\n'> <'\tgit tag -f branch-point &&\n'> <'\n'> <'\techo file2 is not tracked on the master anymore &&\n'> <'\trm -f file2 subdir/file2 &&\n'> <'\tgit update-index --remove file2 subdir/file2 &&\n'> <'\tgit commit -a -m "master removes file2 and subdir/file2"\n'> ) } ) (C {<test_expect_success>} {(SQ <'two-way not clobbering'>)} { (SQ <'\n'> <'\n'> <'\techo >file2 master creates untracked file2 &&\n'> <'\techo >subdir/file2 master creates untracked subdir/file2 &&\n'> <'\tif err=$(read_tree_u_must_succeed -m -u master side 2>&1)\n'> <'\tthen\n'> <'\t\techo should have complained\n'> <'\t\tfalse\n'> <'\telse\n'> <'\t\techo "happy to see $err"\n'> <'\tfi\n'> ) } ) (command.Simple words: [{<echo>} {<file2>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.gitignore>})] do_fork: T ) (C {<test_expect_success>} {(SQ <'two-way with incorrect --exclude-per-directory (1)'>)} { (SQ <'\n'> <'\n'> < '\tif err=$(read_tree_u_must_succeed -m --exclude-per-directory=.gitignore master side 2>&1)\n' > <'\tthen\n'> <'\t\techo should have complained\n'> <'\t\tfalse\n'> <'\telse\n'> <'\t\techo "happy to see $err"\n'> <'\tfi\n'> ) } ) (C {<test_expect_success>} {(SQ <'two-way with incorrect --exclude-per-directory (2)'>)} { (SQ <'\n'> <'\n'> < '\tif err=$(read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1)\n' > <'\tthen\n'> <'\t\techo should have complained\n'> <'\t\tfalse\n'> <'\telse\n'> <'\t\techo "happy to see $err"\n'> <'\tfi\n'> ) } ) (C {<test_expect_success>} {(SQ <'two-way clobbering a ignored file'>)} { (SQ <'\n'> <'\n'> <'\tread_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore master side\n'> ) } ) (C {<rm>} {<-f>} {<.gitignore>}) (C {<test_expect_success>} {(SQ <'three-way not complaining on an untracked path in both'>)} { (SQ <'\n'> <'\n'> <'\trm -f file2 subdir/file2 &&\n'> <'\tgit checkout side &&\n'> <'\techo >file3 file three &&\n'> <'\techo >subdir/file3 file three &&\n'> <'\tgit update-index --add file3 subdir/file3 &&\n'> <'\tgit commit -a -m "side adds file3 and removes file2" &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\techo >file2 file two is untracked on the master side &&\n'> <'\techo >subdir/file2 file two is untracked on the master side &&\n'> <'\n'> <'\tread_tree_u_must_succeed -m -u branch-point master side\n'> ) } ) (C {<test_expect_success>} {(SQ <'three-way not clobbering a working tree file'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\trm -f file2 subdir/file2 file3 subdir/file3 &&\n'> <'\tgit checkout master &&\n'> <'\techo >file3 file three created in master, untracked &&\n'> <'\techo >subdir/file3 file three created in master, untracked &&\n'> <'\tif err=$(read_tree_u_must_succeed -m -u branch-point master side 2>&1)\n'> <'\tthen\n'> <'\t\techo should have complained\n'> <'\t\tfalse\n'> <'\telse\n'> <'\t\techo "happy to see $err"\n'> <'\tfi\n'> ) } ) (command.Simple words: [{<echo>} {<file3>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.gitignore>})] do_fork: T ) (C {<test_expect_success>} {(SQ <'three-way not complaining on an untracked file'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\trm -f file2 subdir/file2 file3 subdir/file3 &&\n'> <'\tgit checkout master &&\n'> <'\techo >file3 file three created in master, untracked &&\n'> <'\techo >subdir/file3 file three created in master, untracked &&\n'> <'\n'> < '\tread_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore branch-point master side\n' > ) } ) (C {<test_expect_success>} {(SQ <'3-way not overwriting local changes (setup)'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout -b side-a branch-point &&\n'> <'\techo >>file1 "new line to be kept in the merge result" &&\n'> <'\tgit commit -a -m "side-a changes file1" &&\n'> <'\tgit checkout -b side-b branch-point &&\n'> <'\techo >>file2 "new line to be kept in the merge result" &&\n'> <'\tgit commit -a -m "side-b changes file2" &&\n'> <'\tgit checkout side-a\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'3-way not overwriting local changes (our side)'>)} { (SQ <'\n'> <'\n'> <'\t# At this point, file1 from side-a should be kept as side-b\n'> <'\t# did not touch it.\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\n'> <'\techo >>file1 "local changes" &&\n'> <'\tread_tree_u_must_succeed -m -u branch-point side-a side-b &&\n'> <'\tgrep "new line to be kept" file1 &&\n'> <'\tgrep "local changes" file1\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'3-way not overwriting local changes (their side)'>)} { (SQ <'\n'> <'\n'> <'\t# At this point, file2 from side-b should be taken as side-a\n'> <'\t# did not touch it.\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\n'> <'\techo >>file2 "local changes" &&\n'> <'\tread_tree_u_must_fail -m -u branch-point side-a side-b &&\n'> <'\t! grep "new line to be kept" file2 &&\n'> <'\tgrep "local changes" file2\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'funny symlink in work tree'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout -b sym-b side-b &&\n'> <'\tmkdir -p a &&\n'> <'\t>a/b &&\n'> <'\tgit add a/b &&\n'> <'\tgit commit -m "side adds a/b" &&\n'> <'\n'> <'\trm -fr a &&\n'> <'\tgit checkout -b sym-a side-a &&\n'> <'\tmkdir -p a &&\n'> <'\ttest_ln_s_add ../b a/b &&\n'> <'\tgit commit -m "we add a/b" &&\n'> <'\n'> <'\tread_tree_u_must_succeed -m -u sym-a sym-a sym-b\n'> <'\n'> ) } ) (C {<test_expect_success>} {<SANITY>} {(SQ <'funny symlink in work tree, un-unlink-able'>)} { (SQ <'\n'> <'\n'> <'\trm -fr a b &&\n'> <'\tgit reset --hard &&\n'> <'\n'> <'\tgit checkout sym-a &&\n'> <'\tchmod a-w a &&\n'> <'\ttest_must_fail git read-tree -m -u sym-a sym-a sym-b\n'> <'\n'> ) } ) (command.Simple words: [{<chmod>} {<a> <Id.Lit_Other '+'> <w>} {<a>}] redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})] do_fork: T ) (C {<rm>} {<-fr>} {<a>} {<b>}) (C {<test_expect_success>} {(SQ <'D/F setup'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\n'> <'\tgit checkout side-a &&\n'> <'\trm -f subdir/file2 &&\n'> <'\tmkdir subdir/file2 &&\n'> <'\techo qfwfq >subdir/file2/another &&\n'> <'\tgit add subdir/file2/another &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "side-a changes file2 to directory"\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'D/F'>)} { (SQ <'\n'> <'\n'> <'\tgit checkout side-b &&\n'> <'\tread_tree_u_must_succeed -m -u branch-point side-b side-a &&\n'> <'\tgit ls-files -u >actual &&\n'> <'\t(\n'> <'\t\ta=$(git rev-parse branch-point:subdir/file2)\n'> <'\t\tb=$(git rev-parse side-a:subdir/file2/another)\n'> <'\t\techo "100644 $a 1\tsubdir/file2"\n'> <'\t\techo "100644 $a 2\tsubdir/file2"\n'> <'\t\techo "100644 $b 3\tsubdir/file2/another"\n'> <'\t) >expect &&\n'> <'\ttest_cmp actual expect\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'D/F resolve'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout side-b &&\n'> <'\tgit merge-resolve branch-point -- side-b side-a\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'D/F recursive'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout side-b &&\n'> <'\tgit merge-recursive branch-point -- side-b side-a\n'> <'\n'> ) } ) (C {<test_done>}) ] )