(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"checkout $tree -- $paths">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\tmkdir dir &&\n"> <"\t>dir/master &&\n"> <"\techo common >dir/common &&\n"> <"\tgit add dir/master dir/common &&\n"> <"\ttest_tick && git commit -m \"master has dir/master\" &&\n"> <"\tgit checkout -b next &&\n"> <"\tgit mv dir/master dir/next0 &&\n"> <"\techo next >dir/next1 &&\n"> <"\tgit add dir &&\n"> <"\ttest_tick && git commit -m \"next has dir/next but not dir/master\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checking out paths out of a tree does not clobber unrelated paths">)} { (SQ <"\n"> <"\tgit checkout next &&\n"> <"\tgit reset --hard &&\n"> <"\trm dir/next0 &&\n"> <"\tcat dir/common >expect.common &&\n"> <"\techo modified >expect.next1 &&\n"> <"\tcat expect.next1 >dir/next1 &&\n"> <"\techo untracked >expect.next2 &&\n"> <"\tcat expect.next2 >dir/next2 &&\n"> <"\n"> <"\tgit checkout master dir &&\n"> <"\n"> <"\ttest_cmp expect.common dir/common &&\n"> <"\ttest_path_is_file dir/master &&\n"> <"\tgit diff --exit-code master dir/master &&\n"> <"\n"> <"\ttest_path_is_missing dir/next0 &&\n"> <"\ttest_cmp expect.next1 dir/next1 &&\n"> <"\ttest_path_is_file dir/next2 &&\n"> <"\ttest_must_fail git ls-files --error-unmatch dir/next2 &&\n"> <"\ttest_cmp expect.next2 dir/next2\n"> ) } ) (C {(test_expect_success)} {(SQ <"do not touch unmerged entries matching $path but not in $tree">)} { (SQ <"\n"> <"\tgit checkout next &&\n"> <"\tgit reset --hard &&\n"> <"\n"> <"\tcat dir/common >expect.common &&\n"> <"\tEMPTY_SHA1=$(git hash-object -w --stdin </dev/null) &&\n"> <"\tgit rm dir/next0 &&\n"> <"\tcat >expect.next0 <<-EOF &&\n"> <"\t100644 $EMPTY_SHA1 1\tdir/next0\n"> <"\t100644 $EMPTY_SHA1 2\tdir/next0\n"> <"\tEOF\n"> <"\tgit update-index --index-info <expect.next0 &&\n"> <"\n"> <"\tgit checkout master dir &&\n"> <"\n"> <"\ttest_cmp expect.common dir/common &&\n"> <"\ttest_path_is_file dir/master &&\n"> <"\tgit diff --exit-code master dir/master &&\n"> <"\tgit ls-files -s dir/next0 >actual.next0 &&\n"> <"\ttest_cmp expect.next0 actual.next0\n"> ) } ) (C {(test_expect_success)} {(SQ <"do not touch files that are already up-to-date">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\techo one >file1 &&\n"> <"\techo two >file2 &&\n"> <"\tgit add file1 file2 &&\n"> <"\tgit commit -m base &&\n"> <"\techo modified >file1 &&\n"> <"\ttest-chmtime =1000000000 file2 &&\n"> <"\tgit update-index -q --refresh &&\n"> <"\tgit checkout HEAD -- file1 file2 &&\n"> <"\techo one >expect &&\n"> <"\ttest_cmp expect file1 &&\n"> <"\techo \"1000000000\tfile2\" >expect &&\n"> <"\ttest-chmtime -v +0 file2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_done)}) ] )