(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:'git checkout-index --temp test.\n' span_id:15) (Token id:Id.Lit_Chars val:'\n' span_id:16) (Token id: Id.Lit_Chars val: 'With --temp flag, git checkout-index writes to temporary merge files\n' span_id: 17 ) (Token id:Id.Lit_Chars val:'rather than the tracked path.' span_id:18) ) } spids: [13] ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:30))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:34) (Token id:Id.Lit_Chars val:'\tmkdir asubdir &&\n' span_id:35) (Token id:Id.Lit_Chars val:'\techo tree1path0 >path0 &&\n' span_id:36) (Token id:Id.Lit_Chars val:'\techo tree1path1 >path1 &&\n' span_id:37) (Token id:Id.Lit_Chars val:'\techo tree1path3 >path3 &&\n' span_id:38) (Token id:Id.Lit_Chars val:'\techo tree1path4 >path4 &&\n' span_id:39) (Token id:Id.Lit_Chars val:'\techo tree1asubdir/path5 >asubdir/path5 &&\n' span_id:40) (Token id: Id.Lit_Chars val: '\tgit update-index --add path0 path1 path3 path4 asubdir/path5 &&\n' span_id: 41 ) (Token id:Id.Lit_Chars val:'\tt1=$(git write-tree) &&\n' span_id:42) (Token id: Id.Lit_Chars val: '\trm -f path* .merge_* actual .git/index &&\n' span_id: 43 ) (Token id:Id.Lit_Chars val:'\techo tree2path0 >path0 &&\n' span_id:44) (Token id:Id.Lit_Chars val:'\techo tree2path1 >path1 &&\n' span_id:45) (Token id:Id.Lit_Chars val:'\techo tree2path2 >path2 &&\n' span_id:46) (Token id:Id.Lit_Chars val:'\techo tree2path4 >path4 &&\n' span_id:47) (Token id:Id.Lit_Chars val:'\tgit update-index --add path0 path1 path2 path4 &&\n' span_id:48) (Token id:Id.Lit_Chars val:'\tt2=$(git write-tree) &&\n' span_id:49) (Token id:Id.Lit_Chars val:'\trm -f path* .merge_* actual .git/index &&\n' span_id:50) (Token id:Id.Lit_Chars val:'\techo tree2path0 >path0 &&\n' span_id:51) (Token id:Id.Lit_Chars val:'\techo tree3path1 >path1 &&\n' span_id:52) (Token id:Id.Lit_Chars val:'\techo tree3path2 >path2 &&\n' span_id:53) (Token id:Id.Lit_Chars val:'\techo tree3path3 >path3 &&\n' span_id:54) (Token id: Id.Lit_Chars val: '\tgit update-index --add path0 path1 path2 path3 &&\n' span_id: 55 ) (Token id:Id.Lit_Chars val:'\tt3=$(git write-tree)\n' span_id:56) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout one stage 0 to temporary file' span_id:63))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:67) (Token id: Id.Lit_Chars val: '\trm -f path* .merge_* actual .git/index &&\n' span_id: 68 ) (Token id:Id.Lit_Chars val:'\tgit read-tree $t1 &&\n' span_id:69) (Token id: Id.Lit_Chars val: '\tgit checkout-index --temp -- path1 >actual &&\n' span_id: 70 ) (Token id:Id.Lit_Chars val:'\ttest_line_count = 1 actual &&\n' span_id:71) (Token id: Id.Lit_Chars val: '\ttest $(cut "-d\t" -f2 actual) = path1 &&\n' span_id: 72 ) (Token id:Id.Lit_Chars val:'\tp=$(cut "-d\t" -f1 actual) &&\n' span_id:73) (Token id:Id.Lit_Chars val:'\ttest -f $p &&\n' span_id:74) (Token id:Id.Lit_Chars val:'\ttest $(cat $p) = tree1path1\n' span_id:75) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout all stage 0 to temporary files' span_id:82))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:86) (Token id: Id.Lit_Chars val: '\trm -f path* .merge_* actual .git/index &&\n' span_id: 87 ) (Token id:Id.Lit_Chars val:'\tgit read-tree $t1 &&\n' span_id:88) (Token id: Id.Lit_Chars val: '\tgit checkout-index -a --temp >actual &&\n' span_id: 89 ) (Token id:Id.Lit_Chars val:'\ttest_line_count = 5 actual &&\n' span_id:90) (Token id: Id.Lit_Chars val: '\tfor f in path0 path1 path3 path4 asubdir/path5\n' span_id: 91 ) (Token id:Id.Lit_Chars val:'\tdo\n' span_id:92) (Token id: Id.Lit_Chars val: '\t\ttest $(grep $f actual | cut "-d\t" -f2) = $f &&\n' span_id: 93 ) (Token id:Id.Lit_Chars val:'\t\tp=$(grep $f actual | cut "-d\t" -f1) &&\n' span_id:94) (Token id:Id.Lit_Chars val:'\t\ttest -f $p &&\n' span_id:95) (Token id:Id.Lit_Chars val:'\t\ttest $(cat $p) = tree1$f\n' span_id:96) (Token id:Id.Lit_Chars val:'\tdone\n' span_id:97) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'setup 3-way merge' span_id:104))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:108) (Token id: Id.Lit_Chars val: '\trm -f path* .merge_* actual .git/index &&\n' span_id: 109 ) (Token id:Id.Lit_Chars val:'\tgit read-tree -m $t1 $t2 $t3\n' span_id:110) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout one stage 2 to temporary file' span_id:117))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:121) (Token id:Id.Lit_Chars val:'\trm -f path* .merge_* actual &&\n' span_id:122) (Token id:Id.Lit_Chars val:'\tgit checkout-index --stage=2 --temp -- path1 >actual &&\n' span_id:123) (Token id:Id.Lit_Chars val:'\ttest_line_count = 1 actual &&\n' span_id:124) (Token id:Id.Lit_Chars val:'\ttest $(cut "-d\t" -f2 actual) = path1 &&\n' span_id:125) (Token id:Id.Lit_Chars val:'\tp=$(cut "-d\t" -f1 actual) &&\n' span_id:126) (Token id:Id.Lit_Chars val:'\ttest -f $p &&\n' span_id:127) (Token id:Id.Lit_Chars val:'\ttest $(cat $p) = tree2path1\n' span_id:128) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout all stage 2 to temporary files' span_id:135))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:139) (Token id:Id.Lit_Chars val:'\trm -f path* .merge_* actual &&\n' span_id:140) (Token id:Id.Lit_Chars val:'\tgit checkout-index --all --stage=2 --temp >actual &&\n' span_id:141) (Token id:Id.Lit_Chars val:'\ttest_line_count = 3 actual &&\n' span_id:142) (Token id:Id.Lit_Chars val:'\tfor f in path1 path2 path4\n' span_id:143) (Token id:Id.Lit_Chars val:'\tdo\n' span_id:144) (Token id:Id.Lit_Chars val:'\t\ttest $(grep $f actual | cut "-d\t" -f2) = $f &&\n' span_id:145) (Token id: Id.Lit_Chars val: '\t\tp=$(grep $f actual | cut "-d\t" -f1) &&\n' span_id: 146 ) (Token id:Id.Lit_Chars val:'\t\ttest -f $p &&\n' span_id:147) (Token id:Id.Lit_Chars val:'\t\ttest $(cat $p) = tree2$f\n' span_id:148) (Token id:Id.Lit_Chars val:'\tdone\n' span_id:149) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout all stages/one file to nothing' span_id:156))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:160) (Token id:Id.Lit_Chars val:'\trm -f path* .merge_* actual &&\n' span_id:161) (Token id: Id.Lit_Chars val: '\tgit checkout-index --stage=all --temp -- path0 >actual &&\n' span_id: 162 ) (Token id:Id.Lit_Chars val:'\ttest_line_count = 0 actual\n' span_id:163) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout all stages/one file to temporary files' span_id:170))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:174) (Token id:Id.Lit_Chars val:'\trm -f path* .merge_* actual &&\n' span_id:175) (Token id: Id.Lit_Chars val: '\tgit checkout-index --stage=all --temp -- path1 >actual &&\n' span_id: 176 ) (Token id:Id.Lit_Chars val:'\ttest_line_count = 1 actual &&\n' span_id:177) (Token id: Id.Lit_Chars val: '\ttest $(cut "-d\t" -f2 actual) = path1 &&\n' span_id: 178 ) (Token id:Id.Lit_Chars val:'\tcut "-d\t" -f1 actual | (read s1 s2 s3 &&\n' span_id:179) (Token id:Id.Lit_Chars val:'\ttest -f $s1 &&\n' span_id:180) (Token id:Id.Lit_Chars val:'\ttest -f $s2 &&\n' span_id:181) (Token id:Id.Lit_Chars val:'\ttest -f $s3 &&\n' span_id:182) (Token id:Id.Lit_Chars val:'\ttest $(cat $s1) = tree1path1 &&\n' span_id:183) (Token id:Id.Lit_Chars val:'\ttest $(cat $s2) = tree2path1 &&\n' span_id:184) (Token id:Id.Lit_Chars val:'\ttest $(cat $s3) = tree3path1)\n' span_id:185) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'checkout some stages/one file to temporary files' span_id: 192 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:196) (Token id:Id.Lit_Chars val:'\trm -f path* .merge_* actual &&\n' span_id:197) (Token id: Id.Lit_Chars val: '\tgit checkout-index --stage=all --temp -- path2 >actual &&\n' span_id: 198 ) (Token id:Id.Lit_Chars val:'\ttest_line_count = 1 actual &&\n' span_id:199) (Token id: Id.Lit_Chars val: '\ttest $(cut "-d\t" -f2 actual) = path2 &&\n' span_id: 200 ) (Token id:Id.Lit_Chars val:'\tcut "-d\t" -f1 actual | (read s1 s2 s3 &&\n' span_id:201) (Token id:Id.Lit_Chars val:'\ttest $s1 = . &&\n' span_id:202) (Token id:Id.Lit_Chars val:'\ttest -f $s2 &&\n' span_id:203) (Token id:Id.Lit_Chars val:'\ttest -f $s3 &&\n' span_id:204) (Token id:Id.Lit_Chars val:'\ttest $(cat $s2) = tree2path2 &&\n' span_id:205) (Token id:Id.Lit_Chars val:'\ttest $(cat $s3) = tree3path2)\n' span_id:206) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'checkout all stages/all files to temporary files' span_id: 213 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:217) (Token id:Id.Lit_Chars val:'\trm -f path* .merge_* actual &&\n' span_id:218) (Token id:Id.Lit_Chars val:'\tgit checkout-index -a --stage=all --temp >actual &&\n' span_id:219) (Token id:Id.Lit_Chars val:'\ttest_line_count = 5 actual\n' span_id:220) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'-- path0: no entry' span_id:227))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:231) (Token id: Id.Lit_Chars val: '\ttest x$(grep path0 actual | cut "-d\t" -f2) = x\n' span_id: 232 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'-- path1: all 3 stages' span_id:239))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:243) (Token id: Id.Lit_Chars val: '\ttest $(grep path1 actual | cut "-d\t" -f2) = path1 &&\n' span_id: 244 ) (Token id:Id.Lit_Chars val:'\tgrep path1 actual | cut "-d\t" -f1 | (read s1 s2 s3 &&\n' span_id:245) (Token id:Id.Lit_Chars val:'\ttest -f $s1 &&\n' span_id:246) (Token id:Id.Lit_Chars val:'\ttest -f $s2 &&\n' span_id:247) (Token id:Id.Lit_Chars val:'\ttest -f $s3 &&\n' span_id:248) (Token id:Id.Lit_Chars val:'\ttest $(cat $s1) = tree1path1 &&\n' span_id:249) (Token id:Id.Lit_Chars val:'\ttest $(cat $s2) = tree2path1 &&\n' span_id:250) (Token id:Id.Lit_Chars val:'\ttest $(cat $s3) = tree3path1)\n' span_id:251) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'-- path2: no stage 1, have stage 2 and 3' span_id:258))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:262) (Token id: Id.Lit_Chars val: '\ttest $(grep path2 actual | cut "-d\t" -f2) = path2 &&\n' span_id: 263 ) (Token id:Id.Lit_Chars val:'\tgrep path2 actual | cut "-d\t" -f1 | (read s1 s2 s3 &&\n' span_id:264) (Token id:Id.Lit_Chars val:'\ttest $s1 = . &&\n' span_id:265) (Token id:Id.Lit_Chars val:'\ttest -f $s2 &&\n' span_id:266) (Token id:Id.Lit_Chars val:'\ttest -f $s3 &&\n' span_id:267) (Token id:Id.Lit_Chars val:'\ttest $(cat $s2) = tree2path2 &&\n' span_id:268) (Token id:Id.Lit_Chars val:'\ttest $(cat $s3) = tree3path2)\n' span_id:269) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'-- path3: no stage 2, have stage 1 and 3' span_id:276))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:280) (Token id: Id.Lit_Chars val: '\ttest $(grep path3 actual | cut "-d\t" -f2) = path3 &&\n' span_id: 281 ) (Token id:Id.Lit_Chars val:'\tgrep path3 actual | cut "-d\t" -f1 | (read s1 s2 s3 &&\n' span_id:282) (Token id:Id.Lit_Chars val:'\ttest -f $s1 &&\n' span_id:283) (Token id:Id.Lit_Chars val:'\ttest $s2 = . &&\n' span_id:284) (Token id:Id.Lit_Chars val:'\ttest -f $s3 &&\n' span_id:285) (Token id:Id.Lit_Chars val:'\ttest $(cat $s1) = tree1path3 &&\n' span_id:286) (Token id:Id.Lit_Chars val:'\ttest $(cat $s3) = tree3path3)\n' span_id:287) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'-- path4: no stage 3, have stage 1 and 3' span_id:294))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:298) (Token id: Id.Lit_Chars val: '\ttest $(grep path4 actual | cut "-d\t" -f2) = path4 &&\n' span_id: 299 ) (Token id:Id.Lit_Chars val:'\tgrep path4 actual | cut "-d\t" -f1 | (read s1 s2 s3 &&\n' span_id:300) (Token id:Id.Lit_Chars val:'\ttest -f $s1 &&\n' span_id:301) (Token id:Id.Lit_Chars val:'\ttest -f $s2 &&\n' span_id:302) (Token id:Id.Lit_Chars val:'\ttest $s3 = . &&\n' span_id:303) (Token id:Id.Lit_Chars val:'\ttest $(cat $s1) = tree1path4 &&\n' span_id:304) (Token id:Id.Lit_Chars val:'\ttest $(cat $s2) = tree2path4)\n' span_id:305) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'-- asubdir/path5: no stage 2 and 3 have stage 1' span_id:312))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:316) (Token id: Id.Lit_Chars val: '\ttest $(grep asubdir/path5 actual | cut "-d\t" -f2) = asubdir/path5 &&\n' span_id: 317 ) (Token id: Id.Lit_Chars val: '\tgrep asubdir/path5 actual | cut "-d\t" -f1 | (read s1 s2 s3 &&\n' span_id: 318 ) (Token id:Id.Lit_Chars val:'\ttest -f $s1 &&\n' span_id:319) (Token id:Id.Lit_Chars val:'\ttest $s2 = . &&\n' span_id:320) (Token id:Id.Lit_Chars val:'\ttest $s3 = . &&\n' span_id:321) (Token id: Id.Lit_Chars val: '\ttest $(cat $s1) = tree1asubdir/path5)\n' span_id: 322 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout --temp within subdir' span_id:329))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:333) (Token id:Id.Lit_Chars val:'\t(\n' span_id:334) (Token id:Id.Lit_Chars val:'\t\tcd asubdir &&\n' span_id:335) (Token id: Id.Lit_Chars val: '\t\tgit checkout-index -a --stage=all >actual &&\n' span_id: 336 ) (Token id:Id.Lit_Chars val:'\t\ttest_line_count = 1 actual &&\n' span_id:337) (Token id: Id.Lit_Chars val: '\t\ttest $(grep path5 actual | cut "-d\t" -f2) = path5 &&\n' span_id: 338 ) (Token id: Id.Lit_Chars val: '\t\tgrep path5 actual | cut "-d\t" -f1 | (read s1 s2 s3 &&\n' span_id: 339 ) (Token id:Id.Lit_Chars val:'\t\ttest -f ../$s1 &&\n' span_id:340) (Token id:Id.Lit_Chars val:'\t\ttest $s2 = . &&\n' span_id:341) (Token id:Id.Lit_Chars val:'\t\ttest $s3 = . &&\n' span_id:342) (Token id: Id.Lit_Chars val: '\t\ttest $(cat ../$s1) = tree1asubdir/path5)\n' span_id: 343 ) (Token id:Id.Lit_Chars val:'\t)\n' span_id:344) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout --temp symlink' span_id:351))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:355) (Token id: Id.Lit_Chars val: '\trm -f path* .merge_* actual .git/index &&\n' span_id: 356 ) (Token id:Id.Lit_Chars val:'\ttest_ln_s_add path7 path6 &&\n' span_id:357) (Token id: Id.Lit_Chars val: '\tgit checkout-index --temp -a >actual &&\n' span_id: 358 ) (Token id:Id.Lit_Chars val:'\ttest_line_count = 1 actual &&\n' span_id:359) (Token id: Id.Lit_Chars val: '\ttest $(cut "-d\t" -f2 actual) = path6 &&\n' span_id: 360 ) (Token id:Id.Lit_Chars val:'\tp=$(cut "-d\t" -f1 actual) &&\n' span_id:361) (Token id:Id.Lit_Chars val:'\ttest -f $p &&\n' span_id:362) (Token id:Id.Lit_Chars val:'\ttest $(cat $p) = path7\n' span_id:363) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'emit well-formed relative path' span_id:370))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:374) (Token id: Id.Lit_Chars val: '\trm -f path* .merge_* actual .git/index &&\n' span_id: 375 ) (Token id:Id.Lit_Chars val:'\t>path0123456789 &&\n' span_id:376) (Token id: Id.Lit_Chars val: '\tgit update-index --add path0123456789 &&\n' span_id: 377 ) (Token id:Id.Lit_Chars val:'\t(\n' span_id:378) (Token id:Id.Lit_Chars val:'\t\tcd asubdir &&\n' span_id:379) (Token id: Id.Lit_Chars val: '\t\tgit checkout-index --temp -- ../path0123456789 >actual &&\n' span_id: 380 ) (Token id:Id.Lit_Chars val:'\t\ttest_line_count = 1 actual &&\n' span_id:381) (Token id: Id.Lit_Chars val: '\t\ttest $(cut "-d\t" -f2 actual) = ../path0123456789\n' span_id: 382 ) (Token id:Id.Lit_Chars val:'\t)\n' span_id:383) ) } ) (C {(test_done)}) ] )