(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:'check various push.default settings' span_id:6))}
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'setup bare remotes' span_id:17))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:21) 
          (Token id:Id.Lit_Chars val:'\tgit init --bare repo1 &&\n' span_id:22) (Token id:Id.Lit_Chars val:'\tgit remote add parent1 repo1 &&\n' span_id:23) 
          (Token id:Id.Lit_Chars val:'\tgit init --bare repo2 &&\n' span_id:24) (Token id:Id.Lit_Chars val:'\tgit remote add parent2 repo2 &&\n' span_id:25) 
          (Token id:Id.Lit_Chars val:'\ttest_commit one &&\n' span_id:26) (Token id:Id.Lit_Chars val:'\tgit push parent1 HEAD &&\n' span_id:27) 
          (Token id:Id.Lit_Chars val:'\tgit push parent2 HEAD\n' span_id:28)
        )
      }
    )
    (command.ShFunction
      name: check_pushed_commit
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [
                    {(git)}
                    {(log)}
                    {(-1)}
                    {(--format) (Id.Lit_Equals '=') (SQ (Token id:Id.Lit_Chars val:'%h %s' span_id:58))}
                    {(DQ ($ Id.VSub_Number '$1'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:65)
                      fd: -1
                      arg_word: {(expect)}
                    )
                  ]
                )
                (command.Simple
                  words: [
                    {(git)}
                    {(--git-dir) (Id.Lit_Equals '=') 
                      (DQ 
                        (braced_var_sub
                          token: (Token id:Id.VSub_Number val:3 span_id:77)
                          suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(repo1)})
                        )
                      )
                    }
                    {(log)}
                    {(-1)}
                    {(--format) (Id.Lit_Equals '=') (SQ (Token id:Id.Lit_Chars val:'%h %s' span_id:90))}
                    {(DQ ($ Id.VSub_Number '$2'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:97)
                      fd: -1
                      arg_word: {(actual)}
                    )
                  ]
                )
                (C {(test_cmp)} {(expect)} {(actual)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_push_success
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {(git)} 
                  {
                    (braced_var_sub
                      token: (Token id:Id.VSub_Number val:1 span_id:132)
                      suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonPlus arg_word:{(-c)})
                    )
                  } 
                  {
                    (braced_var_sub
                      token: (Token id:Id.VSub_Number val:1 span_id:138)
                      suffix_op: 
                        (suffix_op.Unary
                          op_id: Id.VTest_ColonPlus
                          arg_word: {('push.default=') (DQ ($ Id.VSub_Number '$1'))}
                        )
                    )
                  } {(push)}
                )
                (C {(check_pushed_commit)} {(HEAD)} {(DQ ($ Id.VSub_Number '$2'))} 
                  {(DQ ($ Id.VSub_Number '$3'))}
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_push_failure
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [
                    {(git)}
                    {(--git-dir) (Id.Lit_Equals '=') (repo1)}
                    {(log)}
                    {(--no-walk)}
                    {(--format) (Id.Lit_Equals '=') 
                      (SQ (Token id:Id.Lit_Chars val:'%h %s' span_id:193))
                    }
                    {(--all)}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:198)
                      fd: -1
                      arg_word: {(expect)}
                    )
                  ]
                )
                (C {(test_must_fail)} {(git)} 
                  {
                    (braced_var_sub
                      token: (Token id:Id.VSub_Number val:1 span_id:209)
                      suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonPlus arg_word:{(-c)})
                    )
                  } 
                  {
                    (braced_var_sub
                      token: (Token id:Id.VSub_Number val:1 span_id:215)
                      suffix_op: 
                        (suffix_op.Unary
                          op_id: Id.VTest_ColonPlus
                          arg_word: {('push.default=') (DQ ($ Id.VSub_Number '$1'))}
                        )
                    )
                  } {(push)}
                )
                (command.Simple
                  words: [
                    {(git)}
                    {(--git-dir) (Id.Lit_Equals '=') (repo1)}
                    {(log)}
                    {(--no-walk)}
                    {(--format) (Id.Lit_Equals '=') 
                      (SQ (Token id:Id.Lit_Chars val:'%h %s' span_id:241))
                    }
                    {(--all)}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:246)
                      fd: -1
                      arg_word: {(actual)}
                    )
                  ]
                )
                (C {(test_cmp)} {(expect)} {(actual)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_pushdefault_workflow
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:workflow)
                  op: assign_op.Equal
                  rhs: {(central)}
                  spids: [281]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:pushdefault)
                  op: assign_op.Equal
                  rhs: {(parent1)}
                  spids: [285]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(test)} {(-n)} 
                          {
                            (DQ 
                              (braced_var_sub
                                token: (Token id:Id.VSub_Number val:4 span_id:297)
                                suffix_op: (suffix_op.Unary op_id:Id.VTest_Hyphen arg_word:(word.Empty))
                              )
                            )
                          }
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:301)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:workflow)
                          op: assign_op.Equal
                          rhs: {(triangular)}
                          spids: [306]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:pushdefault)
                          op: assign_op.Equal
                          rhs: {(parent2)}
                          spids: [310]
                        )
                      ]
                    )
                  ]
                  spids: [289 303]
                )
              ]
            )
            (C {(test_expect_success)} 
              {
                (DQ ('push.default = ') ($ Id.VSub_Number '$2') (' ') ($ Id.VSub_Number '$1') (' in ') 
                  ($ Id.VSub_DollarName '$workflow') (' workflows')
                )
              } 
              {
                (DQ ('\n') ('\t\ttest_config branch.master.remote parent1 &&\n') 
                  ('\t\ttest_config branch.master.merge refs/heads/foo &&\n') ('\t\ttest_config remote.pushdefault ') ($ Id.VSub_DollarName '$pushdefault') (' &&\n') 
                  ('\t\ttest_commit commit-for-') ($ Id.VSub_Number '$2') 
                  (braced_var_sub
                    token: (Token id:Id.VSub_Number val:4 span_id:339)
                    suffix_op: (suffix_op.Unary op_id:Id.VTest_Plus arg_word:{(-triangular)})
                  ) (' &&\n') ('\t\ttest_push_') ($ Id.VSub_Number '$1') (' ') ($ Id.VSub_Number '$2') (' ') 
                  ($ Id.VSub_Number '$3') (' ') 
                  (braced_var_sub
                    token: (Token id:Id.VSub_Number val:4 span_id:352)
                    suffix_op: (suffix_op.Unary op_id:Id.VTest_Plus arg_word:{(repo2)})
                  ) ('\n') ('\t')
                )
              }
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'"upstream" pushes to configured upstream' span_id:366))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:370) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:371) (Token id:Id.Lit_Chars val:'\ttest_config branch.master.remote parent1 &&\n' span_id:372) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.merge refs/heads/foo &&\n'
            span_id: 373
          ) (Token id:Id.Lit_Chars val:'\ttest_commit two &&\n' span_id:374) 
          (Token id:Id.Lit_Chars val:'\ttest_push_success upstream foo\n' span_id:375)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'"upstream" does not push on unconfigured remote' span_id:382))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:386) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:387) (Token id:Id.Lit_Chars val:'\ttest_unconfig branch.master.remote &&\n' span_id:388) 
          (Token id:Id.Lit_Chars val:'\ttest_commit three &&\n' span_id:389) (Token id:Id.Lit_Chars val:'\ttest_push_failure upstream\n' span_id:390)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'"upstream" does not push on unconfigured branch' span_id:397))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:401) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:402) (Token id:Id.Lit_Chars val:'\ttest_config branch.master.remote parent1 &&\n' span_id:403) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_unconfig branch.master.merge &&\n'
            span_id: 404
          ) (Token id:Id.Lit_Chars val:'\ttest_commit four &&\n' span_id:405) 
          (Token id:Id.Lit_Chars val:'\ttest_push_failure upstream\n' span_id:406)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: '"upstream" does not push when remotes do not match'
            span_id: 413
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:417) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:418) (Token id:Id.Lit_Chars val:'\ttest_config branch.master.remote parent1 &&\n' span_id:419) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.merge refs/heads/foo &&\n'
            span_id: 420
          ) (Token id:Id.Lit_Chars val:'\ttest_config push.default upstream &&\n' span_id:421) 
          (Token id:Id.Lit_Chars val:'\ttest_commit five &&\n' span_id:422) (Token id:Id.Lit_Chars val:'\ttest_must_fail git push parent2\n' span_id:423)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'push from/to new branch with upstream, matching and simple'
            span_id: 430
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:434) 
          (Token id:Id.Lit_Chars val:'\tgit checkout -b new-branch &&\n' span_id:435) (Token id:Id.Lit_Chars val:'\ttest_push_failure simple &&\n' span_id:436) 
          (Token id:Id.Lit_Chars val:'\ttest_push_failure matching &&\n' span_id:437) (Token id:Id.Lit_Chars val:'\ttest_push_failure upstream\n' span_id:438)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'push from/to new branch with current creates remote branch'
            span_id: 445
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:449) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.new-branch.remote repo1 &&\n'
            span_id: 450
          ) (Token id:Id.Lit_Chars val:'\tgit checkout new-branch &&\n' span_id:451) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_push_success current new-branch\n'
            span_id: 452
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'push to existing branch, with no upstream configured'
            span_id: 459
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:463) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.remote repo1 &&\n'
            span_id: 464
          ) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:465) 
          (Token id:Id.Lit_Chars val:'\ttest_push_failure simple &&\n' span_id:466) (Token id:Id.Lit_Chars val:'\ttest_push_failure upstream\n' span_id:467)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'push to existing branch, upstream configured with same name'
            span_id: 474
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:478) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.remote repo1 &&\n'
            span_id: 479
          ) (Token id:Id.Lit_Chars val:'\ttest_config branch.master.merge refs/heads/master &&\n' span_id:480) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:481) (Token id:Id.Lit_Chars val:'\ttest_commit six &&\n' span_id:482) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_push_success upstream master &&\n'
            span_id: 483
          ) (Token id:Id.Lit_Chars val:'\ttest_commit seven &&\n' span_id:484) 
          (Token id:Id.Lit_Chars val:'\ttest_push_success simple master\n' span_id:485)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'push to existing branch, upstream configured with different name'
            span_id: 492
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:496) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.remote repo1 &&\n'
            span_id: 497
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.merge refs/heads/other-name &&\n'
            span_id: 498
          ) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:499) 
          (Token id:Id.Lit_Chars val:'\ttest_commit eight &&\n' span_id:500) (Token id:Id.Lit_Chars val:'\ttest_push_success upstream other-name &&\n' span_id:501) 
          (Token id:Id.Lit_Chars val:'\ttest_commit nine &&\n' span_id:502) (Token id:Id.Lit_Chars val:'\ttest_push_failure simple &&\n' span_id:503) 
          (Token
            id: Id.Lit_Chars
            val: 
'\tgit --git-dir=repo1 log -1 --format="%h %s" "other-name" >expect-other-name &&\n'
            span_id: 504
          ) (Token id:Id.Lit_Chars val:'\ttest_push_success current master &&\n' span_id:505) 
          (Token
            id: Id.Lit_Chars
            val: 
'\tgit --git-dir=repo1 log -1 --format="%h %s" "other-name" >actual-other-name &&\n'
            span_id: 506
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect-other-name actual-other-name\n' span_id:507)
        )
      }
    )
    (C {(test_pushdefault_workflow)} {(success)} {(current)} {(master)})
    (C {(test_pushdefault_workflow)} {(success)} {(upstream)} {(foo)})
    (C {(test_pushdefault_workflow)} {(failure)} {(simple)} {(master)})
    (C {(test_pushdefault_workflow)} {(success)} {(matching)} {(master)})
    (C {(test_pushdefault_workflow)} {(success)} {(current)} {(master)} {(triangular)})
    (C {(test_pushdefault_workflow)} {(failure)} {(upstream)} {(foo)} {(triangular)})
    (C {(test_pushdefault_workflow)} {(success)} {(simple)} {(master)} {(triangular)})
    (C {(test_pushdefault_workflow)} {(success)} {(matching)} {(master)} {(triangular)})
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'default behavior allows "simple" push' span_id:665))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:669) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.remote parent1 &&\n'
            span_id: 670
          ) (Token id:Id.Lit_Chars val:'\ttest_config branch.master.merge refs/heads/master &&\n' span_id:671) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config remote.pushdefault parent1 &&\n'
            span_id: 672
          ) (Token id:Id.Lit_Chars val:'\ttest_commit default-master-master &&\n' span_id:673) 
          (Token id:Id.Lit_Chars val:'\ttest_push_success "" master\n' span_id:674)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'default behavior rejects non-simple push' span_id:681))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:685) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.remote parent1 &&\n'
            span_id: 686
          ) (Token id:Id.Lit_Chars val:'\ttest_config branch.master.merge refs/heads/foo &&\n' span_id:687) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config remote.pushdefault parent1 &&\n'
            span_id: 688
          ) (Token id:Id.Lit_Chars val:'\ttest_commit default-master-foo &&\n' span_id:689) 
          (Token id:Id.Lit_Chars val:'\ttest_push_failure ""\n' span_id:690)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'default triangular behavior acts like "current"' span_id:697))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:701) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config branch.master.remote parent1 &&\n'
            span_id: 702
          ) (Token id:Id.Lit_Chars val:'\ttest_config branch.master.merge refs/heads/foo &&\n' span_id:703) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_config remote.pushdefault parent2 &&\n'
            span_id: 704
          ) (Token id:Id.Lit_Chars val:'\ttest_commit default-triangular &&\n' span_id:705) 
          (Token id:Id.Lit_Chars val:'\ttest_push_success "" master repo2\n' span_id:706)
        )
      }
    )
    (C {(test_done)})
  ]
)