(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: 'checkout can switch to last branch and merge base' span_id: 6 ) ) } spids: [4] ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:18))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:22) (Token id:Id.Lit_Chars val:'\techo hello >world &&\n' span_id:23) (Token id:Id.Lit_Chars val:'\tgit add world &&\n' span_id:24) (Token id:Id.Lit_Chars val:'\tgit commit -m initial &&\n' span_id:25) (Token id:Id.Lit_Chars val:'\tgit branch other &&\n' span_id:26) (Token id:Id.Lit_Chars val:'\techo "hello again" >>world &&\n' span_id:27) (Token id:Id.Lit_Chars val:'\tgit add world &&\n' span_id:28) (Token id:Id.Lit_Chars val:'\tgit commit -m second\n' span_id:29) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" does not work initially' span_id:36))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:40) (Token id:Id.Lit_Chars val:'\ttest_must_fail git checkout -\n' span_id:41) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'first branch switch' span_id:48))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:52) (Token id:Id.Lit_Chars val:'\tgit checkout other\n' span_id:53) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" switches back' span_id:60))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:64) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:65) (Token id:Id.Lit_Chars val:'\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"\n' span_id:66) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" switches forth' span_id:73))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:77) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:78) (Token id:Id.Lit_Chars val:'\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/other"\n' span_id:79) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'detach HEAD' span_id:86))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:90) (Token id:Id.Lit_Chars val:'\tgit checkout $(git rev-parse HEAD)\n' span_id:91) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" attaches again' span_id:98))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:102) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:103) (Token id:Id.Lit_Chars val:'\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/other"\n' span_id:104) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" detaches again' span_id:111))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:115) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:116) (Token id: Id.Lit_Chars val: '\ttest "z$(git rev-parse HEAD)" = "z$(git rev-parse other)" &&\n' span_id: 117 ) (Token id:Id.Lit_Chars val:'\ttest_must_fail git symbolic-ref HEAD\n' span_id:118) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'more switches' span_id:125))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:129) (Token id: Id.Lit_Chars val: '\tfor i in 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\n' span_id: 130 ) (Token id:Id.Lit_Chars val:'\tdo\n' span_id:131) (Token id:Id.Lit_Chars val:'\t\tgit checkout -b branch$i\n' span_id:132) (Token id:Id.Lit_Chars val:'\tdone\n' span_id:133) ) } ) (command.ShFunction name: more_switches body: (command.BraceGroup children: [ (command.ForEach iter_name: i iter_words: [ {(16)} {(15)} {(14)} {(13)} {(12)} {(11)} {(10)} {(9)} {(8)} {(7)} {(6)} {(5)} {(4)} {(3)} {(2)} {(1)} ] do_arg_iter: F body: (command.DoGroup children: [(C {(git)} {(checkout)} {(branch) ($ Id.VSub_DollarName '$i')})] ) ) ] ) ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'switch to the last' span_id:203))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:207) (Token id:Id.Lit_Chars val:'\tmore_switches &&\n' span_id:208) (Token id:Id.Lit_Chars val:'\tgit checkout @{-1} &&\n' span_id:209) (Token id: Id.Lit_Chars val: '\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch2"\n' span_id: 210 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'switch to second from the last' span_id:217))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:221) (Token id:Id.Lit_Chars val:'\tmore_switches &&\n' span_id:222) (Token id:Id.Lit_Chars val:'\tgit checkout @{-2} &&\n' span_id:223) (Token id: Id.Lit_Chars val: '\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch3"\n' span_id: 224 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'switch to third from the last' span_id:231))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:235) (Token id:Id.Lit_Chars val:'\tmore_switches &&\n' span_id:236) (Token id:Id.Lit_Chars val:'\tgit checkout @{-3} &&\n' span_id:237) (Token id: Id.Lit_Chars val: '\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch4"\n' span_id: 238 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'switch to fourth from the last' span_id:245))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:249) (Token id:Id.Lit_Chars val:'\tmore_switches &&\n' span_id:250) (Token id:Id.Lit_Chars val:'\tgit checkout @{-4} &&\n' span_id:251) (Token id: Id.Lit_Chars val: '\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch5"\n' span_id: 252 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'switch to twelfth from the last' span_id:259))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:263) (Token id:Id.Lit_Chars val:'\tmore_switches &&\n' span_id:264) (Token id:Id.Lit_Chars val:'\tgit checkout @{-12} &&\n' span_id:265) (Token id: Id.Lit_Chars val: '\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch13"\n' span_id: 266 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'merge base test setup' span_id:273))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:277) (Token id:Id.Lit_Chars val:'\tgit checkout -b another other &&\n' span_id:278) (Token id:Id.Lit_Chars val:'\techo "hello again" >>world &&\n' span_id:279) (Token id:Id.Lit_Chars val:'\tgit add world &&\n' span_id:280) (Token id:Id.Lit_Chars val:'\tgit commit -m third\n' span_id:281) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:another...master span_id:288))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:292) (Token id:Id.Lit_Chars val:'\tgit checkout another &&\n' span_id:293) (Token id:Id.Lit_Chars val:'\tgit checkout another...master &&\n' span_id:294) (Token id: Id.Lit_Chars val: '\ttest "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify master^)"\n' span_id: 295 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:...master span_id:302))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:306) (Token id:Id.Lit_Chars val:'\tgit checkout another &&\n' span_id:307) (Token id:Id.Lit_Chars val:'\tgit checkout ...master &&\n' span_id:308) (Token id: Id.Lit_Chars val: '\ttest "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify master^)"\n' span_id: 309 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:master... span_id:316))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:320) (Token id:Id.Lit_Chars val:'\tgit checkout another &&\n' span_id:321) (Token id:Id.Lit_Chars val:'\tgit checkout master... &&\n' span_id:322) (Token id: Id.Lit_Chars val: '\ttest "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify master^)"\n' span_id: 323 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" works after a rebase A' span_id:330))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:334) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:335) (Token id:Id.Lit_Chars val:'\tgit checkout other &&\n' span_id:336) (Token id:Id.Lit_Chars val:'\tgit rebase master &&\n' span_id:337) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:338) (Token id: Id.Lit_Chars val: '\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"\n' span_id: 339 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" works after a rebase A B' span_id:346))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:350) (Token id:Id.Lit_Chars val:'\tgit branch moodle master~1 &&\n' span_id:351) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:352) (Token id:Id.Lit_Chars val:'\tgit checkout other &&\n' span_id:353) (Token id:Id.Lit_Chars val:'\tgit rebase master moodle &&\n' span_id:354) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:355) (Token id:Id.Lit_Chars val:'\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"\n' span_id:356) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" works after a rebase -i A' span_id:363))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:367) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:368) (Token id:Id.Lit_Chars val:'\tgit checkout other &&\n' span_id:369) (Token id:Id.Lit_Chars val:'\tgit rebase -i master &&\n' span_id:370) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:371) (Token id: Id.Lit_Chars val: '\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"\n' span_id: 372 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"checkout -" works after a rebase -i A B' span_id:379))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:383) (Token id:Id.Lit_Chars val:'\tgit branch foodle master~1 &&\n' span_id:384) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:385) (Token id:Id.Lit_Chars val:'\tgit checkout other &&\n' span_id:386) (Token id:Id.Lit_Chars val:'\tgit rebase master foodle &&\n' span_id:387) (Token id:Id.Lit_Chars val:'\tgit checkout - &&\n' span_id:388) (Token id:Id.Lit_Chars val:'\ttest "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"\n' span_id:389) ) } ) (C {(test_done)}) ] )