(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:'test <branch>@{upstream} syntax' span_id:6))} spids: [4] ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:19))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:23) (Token id:Id.Lit_Chars val:'\n' span_id:24) (Token id:Id.Lit_Chars val:'\ttest_commit 1 &&\n' span_id:25) (Token id:Id.Lit_Chars val:'\tgit checkout -b side &&\n' span_id:26) (Token id:Id.Lit_Chars val:'\ttest_commit 2 &&\n' span_id:27) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:28) (Token id:Id.Lit_Chars val:'\tgit clone . clone &&\n' span_id:29) (Token id:Id.Lit_Chars val:'\ttest_commit 3 &&\n' span_id:30) (Token id:Id.Lit_Chars val:'\t(cd clone &&\n' span_id:31) (Token id:Id.Lit_Chars val:'\t test_commit 4 &&\n' span_id:32) (Token id: Id.Lit_Chars val: '\t git branch --track my-side origin/side &&\n' span_id: 33 ) (Token id:Id.Lit_Chars val:'\t git branch --track local-master master &&\n' span_id:34) (Token id: Id.Lit_Chars val: '\t git branch --track fun@ny origin/side &&\n' span_id: 35 ) (Token id:Id.Lit_Chars val:'\t git branch --track @funny origin/side &&\n' span_id:36) (Token id: Id.Lit_Chars val: '\t git branch --track funny@ origin/side &&\n' span_id: 37 ) (Token id:Id.Lit_Chars val:'\t git remote add -t master master-only .. &&\n' span_id:38) (Token id:Id.Lit_Chars val:'\t git fetch master-only &&\n' span_id:39) (Token id:Id.Lit_Chars val:'\t git branch bad-upstream &&\n' span_id:40) (Token id: Id.Lit_Chars val: '\t git config branch.bad-upstream.remote master-only &&\n' span_id: 41 ) (Token id:Id.Lit_Chars val:'\t git config branch.bad-upstream.merge refs/heads/side\n' span_id:42) (Token id:Id.Lit_Chars val:'\t)\n' span_id:43) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sq) op: assign_op.Equal rhs: {(DQ ("'"))} spids: [47] ) ] ) (command.ShFunction name: full_name body: (command.BraceGroup children: [ (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(cd)} {(clone)}) (C {(git)} {(rev-parse)} {(--symbolic-full-name)} {(DQ ($ Id.VSub_At '$@'))}) ] ) ] ) ) ] ) ) (command.ShFunction name: commit_subject body: (command.BraceGroup children: [ (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(cd)} {(clone)}) (C {(git)} {(show)} {(-s)} {(--pretty) (Id.Lit_Equals '=') (format) (Id.Lit_Other ':') (Id.Lit_Other '%') (s) } {(DQ ($ Id.VSub_At '$@'))} ) ] ) ] ) ) ] ) ) (command.ShFunction name: error_message body: (command.BraceGroup children: [ (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(cd)} {(clone)}) (C {(test_must_fail)} {(git)} {(rev-parse)} {(--verify)} {(DQ ($ Id.VSub_At '$@'))}) ] ) ] ) ) ] ) ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'@{upstream} resolves to correct full name' span_id:155))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:159) (Token id: Id.Lit_Chars val: '\ttest refs/remotes/origin/master = "$(full_name @{upstream})"\n' span_id: 160 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'@{u} resolves to correct full name' span_id:167))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:171) (Token id: Id.Lit_Chars val: '\ttest refs/remotes/origin/master = "$(full_name @{u})"\n' span_id: 172 ) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'my-side@{upstream} resolves to correct full name' span_id: 179 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:183) (Token id: Id.Lit_Chars val: '\ttest refs/remotes/origin/side = "$(full_name my-side@{u})"\n' span_id: 184 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'upstream of branch with @ in middle' span_id:191))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:195) (Token id:Id.Lit_Chars val:'\tfull_name fun@ny@{u} >actual &&\n' span_id:196) (Token id:Id.Lit_Chars val:'\techo refs/remotes/origin/side >expect &&\n' span_id:197) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:198) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'upstream of branch with @ at start' span_id:205))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:209) (Token id:Id.Lit_Chars val:'\tfull_name @funny@{u} >actual &&\n' span_id:210) (Token id:Id.Lit_Chars val:'\techo refs/remotes/origin/side >expect &&\n' span_id:211) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:212) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'upstream of branch with @ at end' span_id:219))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:223) (Token id:Id.Lit_Chars val:'\tfull_name funny@@{u} >actual &&\n' span_id:224) (Token id:Id.Lit_Chars val:'\techo refs/remotes/origin/side >expect &&\n' span_id:225) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:226) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'refs/heads/my-side@{upstream} does not resolve to my-side{upstream}' span_id: 233 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:237) (Token id: Id.Lit_Chars val: '\ttest_must_fail full_name refs/heads/my-side@{upstream}\n' span_id: 238 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'my-side@{u} resolves to correct commit' span_id:245))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:249) (Token id:Id.Lit_Chars val:'\tgit checkout side &&\n' span_id:250) (Token id:Id.Lit_Chars val:'\ttest_commit 5 &&\n' span_id:251) (Token id:Id.Lit_Chars val:'\t(cd clone && git fetch) &&\n' span_id:252) (Token id:Id.Lit_Chars val:'\ttest 2 = "$(commit_subject my-side)" &&\n' span_id:253) (Token id: Id.Lit_Chars val: '\ttest 5 = "$(commit_subject my-side@{u})"\n' span_id: 254 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'not-tracking@{u} fails' span_id:261))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:265) (Token id: Id.Lit_Chars val: '\ttest_must_fail full_name non-tracking@{u} &&\n' span_id: 266 ) (Token id: Id.Lit_Chars val: '\t(cd clone && git checkout --no-track -b non-tracking) &&\n' span_id: 267 ) (Token id:Id.Lit_Chars val:'\ttest_must_fail full_name non-tracking@{u}\n' span_id:268) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'<branch>@{u}@{1} resolves correctly' span_id:275))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:279) (Token id:Id.Lit_Chars val:'\ttest_commit 6 &&\n' span_id:280) (Token id:Id.Lit_Chars val:'\t(cd clone && git fetch) &&\n' span_id:281) (Token id: Id.Lit_Chars val: '\ttest 5 = $(commit_subject my-side@{u}@{1})\n' span_id: 282 ) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: '@{u} without specifying branch fails on a detached HEAD' span_id: 289 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:293) (Token id:Id.Lit_Chars val:'\tgit checkout HEAD^0 &&\n' span_id:294) (Token id:Id.Lit_Chars val:'\ttest_must_fail git rev-parse @{u}\n' span_id:295) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout -b new my-side@{u} forks from the same' span_id:302))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:306) (Token id:Id.Lit_Chars val:'(\n' span_id:307) (Token id:Id.Lit_Chars val:'\tcd clone &&\n' span_id:308) (Token id:Id.Lit_Chars val:'\tgit checkout -b new my-side@{u} &&\n' span_id:309) (Token id: Id.Lit_Chars val: '\tgit rev-parse --symbolic-full-name my-side@{u} >expect &&\n' span_id: 310 ) (Token id:Id.Lit_Chars val:'\tgit rev-parse --symbolic-full-name new@{u} >actual &&\n' span_id:311) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:312) (Token id:Id.Lit_Chars val:')\n' span_id:313) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'merge my-side@{u} records the correct name' span_id:320))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:324) (Token id:Id.Lit_Chars val:'(\n' span_id:325) (Token id:Id.Lit_Chars val:'\tcd clone || exit\n' span_id:326) (Token id:Id.Lit_Chars val:'\tgit checkout master || exit\n' span_id:327) (Token id: Id.Lit_Chars val: '\tgit branch -D new ;# can fail but is ok\n' span_id: 328 ) (Token id:Id.Lit_Chars val:'\tgit branch -t new my-side@{u} &&\n' span_id:329) (Token id:Id.Lit_Chars val:'\tgit merge -s ours new@{u} &&\n' span_id:330) (Token id:Id.Lit_Chars val:'\tgit show -s --pretty=tformat:%s >actual &&\n' span_id:331) (Token id: Id.Lit_Chars val: '\techo "Merge remote-tracking branch ${sq}origin/side${sq}" >expect &&\n' span_id: 332 ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:333) (Token id:Id.Lit_Chars val:')\n' span_id:334) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'branch -d other@{u}' span_id:341))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:345) (Token id:Id.Lit_Chars val:'\tgit checkout -t -b other master &&\n' span_id:346) (Token id:Id.Lit_Chars val:'\tgit branch -d @{u} &&\n' span_id:347) (Token id: Id.Lit_Chars val: '\tgit for-each-ref refs/heads/master >actual &&\n' span_id: 348 ) (Token id:Id.Lit_Chars val:'\t>expect &&\n' span_id:349) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:350) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout other@{u}' span_id:357))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:361) (Token id:Id.Lit_Chars val:'\tgit branch -f master HEAD &&\n' span_id:362) (Token id:Id.Lit_Chars val:'\tgit checkout -t -b another master &&\n' span_id:363) (Token id:Id.Lit_Chars val:'\tgit checkout @{u} &&\n' span_id:364) (Token id:Id.Lit_Chars val:'\tgit symbolic-ref HEAD >actual &&\n' span_id:365) (Token id:Id.Lit_Chars val:'\techo refs/heads/master >expect &&\n' span_id:366) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:367) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'branch@{u} works when tracking a local branch' span_id:374))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:378) (Token id: Id.Lit_Chars val: '\ttest refs/heads/master = "$(full_name local-master@{u})"\n' span_id: 379 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'branch@{u} error message when no upstream' span_id:386))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:390) (Token id:Id.Lit_Chars val:'\tcat >expect <<-EOF &&\n' span_id:391) (Token id: Id.Lit_Chars val: '\tfatal: no upstream configured for branch ${sq}non-tracking${sq}\n' span_id: 392 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:393) (Token id: Id.Lit_Chars val: '\terror_message non-tracking@{u} 2>actual &&\n' span_id: 394 ) (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect actual\n' span_id:395) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'@{u} error message when no upstream' span_id:402))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:406) (Token id:Id.Lit_Chars val:'\tcat >expect <<-EOF &&\n' span_id:407) (Token id: Id.Lit_Chars val: '\tfatal: no upstream configured for branch ${sq}master${sq}\n' span_id: 408 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:409) (Token id: Id.Lit_Chars val: '\ttest_must_fail git rev-parse --verify @{u} 2>actual &&\n' span_id: 410 ) (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect actual\n' span_id:411) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'branch@{u} error message with misspelt branch' span_id:418))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:422) (Token id:Id.Lit_Chars val:'\tcat >expect <<-EOF &&\n' span_id:423) (Token id:Id.Lit_Chars val:'\tfatal: no such branch: ${sq}no-such-branch${sq}\n' span_id:424) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:425) (Token id:Id.Lit_Chars val:'\terror_message no-such-branch@{u} 2>actual &&\n' span_id:426) (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect actual\n' span_id:427) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'@{u} error message when not on a branch' span_id:434))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:438) (Token id:Id.Lit_Chars val:'\tcat >expect <<-EOF &&\n' span_id:439) (Token id:Id.Lit_Chars val:'\tfatal: HEAD does not point to a branch\n' span_id:440) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:441) (Token id:Id.Lit_Chars val:'\tgit checkout HEAD^0 &&\n' span_id:442) (Token id: Id.Lit_Chars val: '\ttest_must_fail git rev-parse --verify @{u} 2>actual &&\n' span_id: 443 ) (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect actual\n' span_id:444) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'branch@{u} error message if upstream branch not fetched' span_id: 451 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:455) (Token id:Id.Lit_Chars val:'\tcat >expect <<-EOF &&\n' span_id:456) (Token id: Id.Lit_Chars val: '\tfatal: upstream branch ${sq}refs/heads/side${sq} not stored as a remote-tracking branch\n' span_id: 457 ) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:458) (Token id: Id.Lit_Chars val: '\terror_message bad-upstream@{u} 2>actual &&\n' span_id: 459 ) (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect actual\n' span_id:460) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'pull works when tracking a local branch' span_id:467))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:471) (Token id:Id.Lit_Chars val:'(\n' span_id:472) (Token id:Id.Lit_Chars val:'\tcd clone &&\n' span_id:473) (Token id:Id.Lit_Chars val:'\tgit checkout local-master &&\n' span_id:474) (Token id:Id.Lit_Chars val:'\tgit pull\n' span_id:475) (Token id:Id.Lit_Chars val:')\n' span_id:476) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'@{u} works when tracking a local branch' span_id:486))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:490) (Token id: Id.Lit_Chars val: '\ttest refs/heads/master = "$(full_name @{u})"\n' span_id: 491 ) ) } ) (command.Simple words: [{(cat)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:497) fd: -1 arg_word: {(expect)} ) (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:500) fd: -1 here_begin: {(EOF)} here_end_span_id: 511 stdin_parts: [ ('commit 8f489d01d0cc65c3b0f09504ec50b5ed02a70bd5\n') ('Reflog: master@{0} (C O Mitter <committer@example.com>)\n') ('Reflog message: branch: Created from HEAD\n') ('Author: A U Thor <author@example.com>\n') ('Date: Thu Apr 7 15:15:13 2005 -0700\n') ('\n') (' 3\n') ] ) ] ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'log -g other@{u}' span_id:515))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:519) (Token id:Id.Lit_Chars val:'\tgit log -1 -g other@{u} >actual &&\n' span_id:520) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:521) ) } ) (command.Simple words: [{(cat)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:527) fd: -1 arg_word: {(expect)} ) (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:530) fd: -1 here_begin: {(EOF)} here_end_span_id: 541 stdin_parts: [ ('commit 8f489d01d0cc65c3b0f09504ec50b5ed02a70bd5\n') ( 'Reflog: master@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter <committer@example.com>)\n' ) ('Reflog message: branch: Created from HEAD\n') ('Author: A U Thor <author@example.com>\n') ('Date: Thu Apr 7 15:15:13 2005 -0700\n') ('\n') (' 3\n') ] ) ] ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'log -g other@{u}@{now}' span_id:546))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:550) (Token id: Id.Lit_Chars val: '\tgit log -1 -g other@{u}@{now} >actual &&\n' span_id: 551 ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:552) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'@{reflog}-parsing does not look beyond colon' span_id:559))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:563) (Token id:Id.Lit_Chars val:'\techo content >@{yesterday} &&\n' span_id:564) (Token id:Id.Lit_Chars val:'\tgit add @{yesterday} &&\n' span_id:565) (Token id: Id.Lit_Chars val: '\tgit commit -m "funny reflog file" &&\n' span_id: 566 ) (Token id:Id.Lit_Chars val:'\tgit hash-object @{yesterday} >expect &&\n' span_id:567) (Token id: Id.Lit_Chars val: '\tgit rev-parse HEAD:@{yesterday} >actual\n' span_id: 568 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'@{upstream}-parsing does not look beyond colon' span_id:575))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:579) (Token id:Id.Lit_Chars val:'\techo content >@{upstream} &&\n' span_id:580) (Token id:Id.Lit_Chars val:'\tgit add @{upstream} &&\n' span_id:581) (Token id: Id.Lit_Chars val: '\tgit commit -m "funny upstream file" &&\n' span_id: 582 ) (Token id:Id.Lit_Chars val:'\tgit hash-object @{upstream} >expect &&\n' span_id:583) (Token id: Id.Lit_Chars val: '\tgit rev-parse HEAD:@{upstream} >actual\n' span_id: 584 ) ) } ) (C {(test_done)}) ] )