(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"remote tracking stats">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: advance
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(echo)} {(DQ ($ VSub_Number "$1"))}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {(DQ ($ VSub_Number "$1"))}
                      spids: [29]
                    )
                  ]
                )
                (AndOr
                  children: [
                    (C {(git)} {(add)} {(DQ ($ VSub_Number "$1"))})
                    (AndOr
                      children: [
                        (C {(test_tick)})
                        (C {(git)} {(commit)} {(-m)} {(DQ ($ VSub_Number "$1"))})
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [20]
        )
      spids: [15 19]
    )
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <"\n"> <"\tadvance a &&\n"> <"\tadvance b &&\n"> <"\tadvance c &&\n"> 
          <"\tgit clone . test &&\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout -b b1 origin &&\n"> 
          <"\t\tgit reset --hard HEAD^ &&\n"> <"\t\tadvance d &&\n"> <"\t\tgit checkout -b b2 origin &&\n"> <"\t\tgit reset --hard b1 &&\n"> 
          <"\t\tgit checkout -b b3 origin &&\n"> <"\t\tgit reset --hard HEAD^ &&\n"> <"\t\tgit checkout -b b4 origin &&\n"> <"\t\tadvance e &&\n"> 
          <"\t\tadvance f &&\n"> <"\t\tgit checkout -b brokenbase origin &&\n"> <"\t\tgit checkout -b b5 --track brokenbase &&\n"> 
          <"\t\tadvance g &&\n"> <"\t\tgit branch -d brokenbase &&\n"> <"\t\tgit checkout -b b6 origin\n"> <"\t) &&\n"> 
          <"\tgit checkout -b follower --track master &&\n"> <"\tadvance h\n">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:script)
          op: Equal
          rhs: {(SQ <"s/^..\\(b.\\) *[0-9a-f]* \\(.*\\)$/\\1 \\2/p">)}
          spids: [99]
        )
      ]
      spids: [99]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[106])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {("b1 [ahead 1, behind 1] d\n") ("b2 [ahead 1, behind 1] d\n") ("b3 [behind 1] b\n") 
              ("b4 [ahead 2] f\n") ("b5 g\n") ("b6 c\n")
            }
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [109]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"branch -v">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit branch -v\n"> <"\t) |\n"> 
          <"\tsed -n -e \"$script\" >actual &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[133])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {("b1 [origin/master: ahead 1, behind 1] d\n") 
              ("b2 [origin/master: ahead 1, behind 1] d\n") ("b3 [origin/master: behind 1] b\n") ("b4 [origin/master: ahead 2] f\n") ("b5 [brokenbase: gone] g\n") 
              ("b6 [origin/master] c\n")
            }
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [136]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"branch -vv">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit branch -vv\n"> <"\t) |\n"> 
          <"\tsed -n -e \"$script\" >actual &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"checkout (diverged from upstream)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test && git checkout b1\n"> <"\t) >actual &&\n"> 
          <"\ttest_i18ngrep \"have 1 and 1 different\" actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"checkout with local tracked branch">)} 
      {
        (SQ <"\n"> <"\tgit checkout master &&\n"> <"\tgit checkout follower >actual &&\n"> 
          <"\ttest_i18ngrep \"is ahead of\" actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"checkout (upstream is gone)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout b5\n"> <"\t) >actual &&\n"> 
          <"\ttest_i18ngrep \"is based on .*, but the upstream is gone.\" actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"checkout (up-to-date with upstream)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test && git checkout b6\n"> <"\t) >actual &&\n"> 
          <"\ttest_i18ngrep \"Your branch is up-to-date with .origin/master\" actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"status (diverged from upstream)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout b1 >/dev/null &&\n"> 
          <"\t\t# reports nothing to commit\n"> <"\t\ttest_must_fail git commit --dry-run\n"> <"\t) >actual &&\n"> 
          <"\ttest_i18ngrep \"have 1 and 1 different\" actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"status (upstream is gone)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout b5 >/dev/null &&\n"> 
          <"\t\t# reports nothing to commit\n"> <"\t\ttest_must_fail git commit --dry-run\n"> <"\t) >actual &&\n"> 
          <"\ttest_i18ngrep \"is based on .*, but the upstream is gone.\" actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"status (up-to-date with upstream)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout b6 >/dev/null &&\n"> 
          <"\t\t# reports nothing to commit\n"> <"\t\ttest_must_fail git commit --dry-run\n"> <"\t) >actual &&\n"> 
          <"\ttest_i18ngrep \"Your branch is up-to-date with .origin/master\" actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[274])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("## b1...origin/master [ahead 1, behind 1]\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [277]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"status -s -b (diverged from upstream)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout b1 >/dev/null &&\n"> 
          <"\t\tgit status -s -b | head -1\n"> <"\t) >actual &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[301])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("## b5...brokenbase [gone]\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [304]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"status -s -b (upstream is gone)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout b5 >/dev/null &&\n"> 
          <"\t\tgit status -s -b | head -1\n"> <"\t) >actual &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[328])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("## b6...origin/master\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [331]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"status -s -b (up-to-date with upstream)">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd test &&\n"> <"\t\tgit checkout b6 >/dev/null &&\n"> 
          <"\t\tgit status -s -b | head -1\n"> <"\t) >actual &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"fail to track lightweight tags">)} 
      {
        (SQ <"\n"> <"\tgit checkout master &&\n"> <"\tgit tag light &&\n"> 
          <"\ttest_must_fail git branch --track lighttrack light >actual &&\n"> <"\ttest_i18ngrep ! \"set up to track\" actual &&\n"> <"\ttest_must_fail git checkout lighttrack\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"fail to track annotated tags">)} 
      {
        (SQ <"\n"> <"\tgit checkout master &&\n"> <"\tgit tag -m heavy heavy &&\n"> 
          <"\ttest_must_fail git branch --track heavytrack heavy >actual &&\n"> <"\ttest_i18ngrep ! \"set up to track\" actual &&\n"> <"\ttest_must_fail git checkout heavytrack\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"setup tracking with branch --set-upstream on existing branch">)} 
      {
        (SQ <"\n"> <"\tgit branch from-master master &&\n"> 
          <"\ttest_must_fail git config branch.from-master.merge > actual &&\n"> <"\tgit branch --set-upstream from-master master &&\n"> 
          <"\tgit config branch.from-master.merge > actual &&\n"> <"\tgrep -q \"^refs/heads/master$\" actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--set-upstream does not change branch">)} 
      {
        (SQ <"\n"> <"\tgit branch from-master2 master &&\n"> 
          <"\ttest_must_fail git config branch.from-master2.merge > actual &&\n"> <"\tgit rev-list from-master2 &&\n"> <"\tgit update-ref refs/heads/from-master2 from-master2^ &&\n"> 
          <"\tgit rev-parse from-master2 >expect2 &&\n"> <"\tgit branch --set-upstream from-master2 master &&\n"> 
          <"\tgit config branch.from-master.merge > actual &&\n"> <"\tgit rev-parse from-master2 >actual2 &&\n"> <"\tgrep -q \"^refs/heads/master$\" actual &&\n"> 
          <"\tcmp expect2 actual2\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--set-upstream @{-1}">)} 
      {
        (SQ <"\n"> <"\tgit checkout from-master &&\n"> <"\tgit checkout from-master2 &&\n"> 
          <"\tgit config branch.from-master2.merge > expect2 &&\n"> <"\tgit branch --set-upstream @{-1} follower &&\n"> 
          <"\tgit config branch.from-master.merge > actual &&\n"> <"\tgit config branch.from-master2.merge > actual2 &&\n"> 
          <"\tgit branch --set-upstream from-master follower &&\n"> <"\tgit config branch.from-master.merge > expect &&\n"> <"\ttest_cmp expect2 actual2 &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_done)})
  ]
)