(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:'push with --set-upstream' span_id:6))}
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) (/lib-terminal.sh)})
    (command.ShFunction
      name: ensure_fresh_upstream
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [(C {(rm)} {(-rf)} {(parent)}) (C {(git)} {(init)} {(--bare)} {(parent)})]
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'setup bare parent' span_id:50))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:54) 
          (Token id:Id.Lit_Chars val:'\tensure_fresh_upstream &&\n' span_id:55) (Token id:Id.Lit_Chars val:'\tgit remote add upstream parent\n' span_id:56)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'setup local commit' span_id:63))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:67) 
          (Token id:Id.Lit_Chars val:'\techo content >file &&\n' span_id:68) (Token id:Id.Lit_Chars val:'\tgit add file &&\n' span_id:69) 
          (Token id:Id.Lit_Chars val:'\tgit commit -m one\n' span_id:70)
        )
      }
    )
    (command.ShFunction
      name: check_config
      body: 
        (command.BraceGroup
          children: [
            (command.Subshell
              command_list: 
                (command.CommandList
                  children: [
                    (command.Sentence
                      child: (C {(echo)} {($ Id.VSub_Number '$2')})
                      terminator: (Token id:Id.Op_Semi val:';' span_id:85)
                    )
                    (C {(echo)} {($ Id.VSub_Number '$3')})
                  ]
                )
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:92)
                  fd: -1
                  arg_word: {(expect.) ($ Id.VSub_Number '$1')}
                )
              ]
            )
            (command.Subshell
              command_list: 
                (command.CommandList
                  children: [
                    (C {(git)} {(config)} {(branch.) ($ Id.VSub_Number '$1') (.remote)})
                    (C {(git)} {(config)} {(branch.) ($ Id.VSub_Number '$1') (.merge)})
                  ]
                )
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:116)
                  fd: -1
                  arg_word: {(actual.) ($ Id.VSub_Number '$1')}
                )
              ]
            )
            (C {(test_cmp)} {(expect.) ($ Id.VSub_Number '$1')} {(actual.) ($ Id.VSub_Number '$1')})
          ]
        )
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'push -u master:master' span_id:135))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:139) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit push -u upstream master:master &&\n'
            span_id: 140
          ) (Token id:Id.Lit_Chars val:'\tcheck_config master upstream refs/heads/master\n' span_id:141)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'push -u master:other' span_id:148))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:152) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit push -u upstream master:other &&\n'
            span_id: 153
          ) (Token id:Id.Lit_Chars val:'\tcheck_config master upstream refs/heads/other\n' span_id:154)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'push -u --dry-run master:otherX' span_id:161))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:165) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit push -u --dry-run upstream master:otherX &&\n'
            span_id: 166
          ) (Token id:Id.Lit_Chars val:'\tcheck_config master upstream refs/heads/other\n' span_id:167)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'push -u master2:master2' span_id:174))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:178) 
          (Token id:Id.Lit_Chars val:'\tgit branch master2 &&\n' span_id:179) (Token id:Id.Lit_Chars val:'\tgit push -u upstream master2:master2 &&\n' span_id:180) 
          (Token
            id: Id.Lit_Chars
            val: '\tcheck_config master2 upstream refs/heads/master2\n'
            span_id: 181
          )
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'push -u master2:other2' span_id:188))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:192) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit push -u upstream master2:other2 &&\n'
            span_id: 193
          ) (Token id:Id.Lit_Chars val:'\tcheck_config master2 upstream refs/heads/other2\n' span_id:194)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'push -u :master2' span_id:201))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:205) 
          (Token id:Id.Lit_Chars val:'\tgit push -u upstream :master2 &&\n' span_id:206) (Token id:Id.Lit_Chars val:'\tcheck_config master2 upstream refs/heads/other2\n' span_id:207)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'push -u --all' span_id:214))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:218) 
          (Token id:Id.Lit_Chars val:'\tgit branch all1 &&\n' span_id:219) (Token id:Id.Lit_Chars val:'\tgit branch all2 &&\n' span_id:220) 
          (Token id:Id.Lit_Chars val:'\tgit push -u --all &&\n' span_id:221) (Token id:Id.Lit_Chars val:'\tcheck_config all1 upstream refs/heads/all1 &&\n' span_id:222) 
          (Token
            id: Id.Lit_Chars
            val: '\tcheck_config all2 upstream refs/heads/all2\n'
            span_id: 223
          )
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'push -u HEAD' span_id:230))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:234) 
          (Token id:Id.Lit_Chars val:'\tgit checkout -b headbranch &&\n' span_id:235) (Token id:Id.Lit_Chars val:'\tgit push -u upstream HEAD &&\n' span_id:236) 
          (Token
            id: Id.Lit_Chars
            val: '\tcheck_config headbranch upstream refs/heads/headbranch\n'
            span_id: 237
          )
        )
      }
    )
    (C {(test_expect_success)} {(TTY)} 
      {(SQ (Token id:Id.Lit_Chars val:'progress messages go to tty' span_id:246))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:250) 
          (Token id:Id.Lit_Chars val:'\tensure_fresh_upstream &&\n' span_id:251) (Token id:Id.Lit_Chars val:'\n' span_id:252) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_terminal git push -u upstream master >out 2>err &&\n'
            span_id: 253
          ) (Token id:Id.Lit_Chars val:'\ttest_i18ngrep "Writing objects" err\n' span_id:254)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'progress messages do not go to non-tty' span_id:261))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:265) 
          (Token id:Id.Lit_Chars val:'\tensure_fresh_upstream &&\n' span_id:266) (Token id:Id.Lit_Chars val:'\n' span_id:267) 
          (Token
            id: Id.Lit_Chars
            val: '\t# skip progress messages, since stderr is non-tty\n'
            span_id: 268
          ) (Token id:Id.Lit_Chars val:'\tgit push -u upstream master >out 2>err &&\n' span_id:269) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_i18ngrep ! "Writing objects" err\n'
            span_id: 270
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'progress messages go to non-tty (forced)' span_id:277))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:281) 
          (Token id:Id.Lit_Chars val:'\tensure_fresh_upstream &&\n' span_id:282) (Token id:Id.Lit_Chars val:'\n' span_id:283) 
          (Token
            id: Id.Lit_Chars
            val: '\t# force progress messages to stderr, even though it is non-tty\n'
            span_id: 284
          ) (Token id:Id.Lit_Chars val:'\tgit push -u --progress upstream master >out 2>err &&\n' span_id:285) 
          (Token id:Id.Lit_Chars val:'\ttest_i18ngrep "Writing objects" err\n' span_id:286)
        )
      }
    )
    (C {(test_expect_success)} {(TTY)} 
      {(SQ (Token id:Id.Lit_Chars val:'push -q suppresses progress' span_id:295))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:299) 
          (Token id:Id.Lit_Chars val:'\tensure_fresh_upstream &&\n' span_id:300) (Token id:Id.Lit_Chars val:'\n' span_id:301) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_terminal git push -u -q upstream master >out 2>err &&\n'
            span_id: 302
          ) (Token id:Id.Lit_Chars val:'\ttest_i18ngrep ! "Writing objects" err\n' span_id:303)
        )
      }
    )
    (C {(test_expect_success)} {(TTY)} 
      {(SQ (Token id:Id.Lit_Chars val:'push --no-progress suppresses progress' span_id:312))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:316) 
          (Token id:Id.Lit_Chars val:'\tensure_fresh_upstream &&\n' span_id:317) (Token id:Id.Lit_Chars val:'\n' span_id:318) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_terminal git push -u --no-progress upstream master >out 2>err &&\n'
            span_id: 319
          ) (Token id:Id.Lit_Chars val:'\ttest_i18ngrep ! "Unpacking objects" err &&\n' span_id:320) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_i18ngrep ! "Writing objects" err\n'
            span_id: 321
          )
        )
      }
    )
    (C {(test_expect_success)} {(TTY)} {(SQ (Token id:Id.Lit_Chars val:'quiet push' span_id:330))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:334) 
          (Token id:Id.Lit_Chars val:'\tensure_fresh_upstream &&\n' span_id:335) (Token id:Id.Lit_Chars val:'\n' span_id:336) 
          (Token
            id: Id.Lit_Chars
            val: 
'\ttest_terminal git push --quiet --no-progress upstream master 2>&1 | tee output &&\n'
            span_id: 337
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp /dev/null output\n' span_id:338)
        )
      }
    )
    (C {(test_done)})
  ]
)