(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'messages from rebase operation'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\ttest_commit O fileO &&\n'> <'\ttest_commit X fileX &&\n'> 
          <'\ttest_commit A fileA &&\n'> <'\ttest_commit B fileB &&\n'> <'\ttest_commit Y fileY &&\n'> <'\n'> <'\tgit checkout -b topic O &&\n'> 
          <'\tgit cherry-pick A B &&\n'> <'\ttest_commit Z fileZ &&\n'> <'\tgit tag start\n'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 48
              stdin_parts: [
                <'Already applied: 0001 A\n'>
                <'Already applied: 0002 B\n'>
                <'Committed: 0003 Z\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'rebase -m'>)} 
      {
        (SQ <'\n'> <'\tgit rebase -m master >report &&\n'> <'\tsed -n -e "/^Already applied: /p" \\\n'> 
          <'\t\t-e "/^Committed: /p" report >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase against master twice'>)} 
      {
        (SQ <'\n'> <'\tgit rebase master >out &&\n'> 
          <'\ttest_i18ngrep "Current branch topic is up to date" out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase against master twice with --force'>)} 
      {
        (SQ <'\n'> <'\tgit rebase --force-rebase master >out &&\n'> 
          <'\ttest_i18ngrep "Current branch topic is up to date, rebase forced" out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase against master twice from another branch'>)} 
      {
        (SQ <'\n'> <'\tgit checkout topic^ &&\n'> <'\tgit rebase master topic >out &&\n'> 
          <'\ttest_i18ngrep "Current branch topic is up to date" out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase fast-forward to master'>)} 
      {
        (SQ <'\n'> <'\tgit checkout topic^ &&\n'> <'\tgit rebase topic >out &&\n'> 
          <'\ttest_i18ngrep "Fast-forwarded HEAD to topic" out\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase --stat'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard start &&\n'> 
          <'        git rebase --stat master >diffstat.txt &&\n'> <'        grep "^ fileX |  *1 +$" diffstat.txt\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase w/config rebase.stat'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard start &&\n'> <'        git config rebase.stat true &&\n'> 
          <'        git rebase master >diffstat.txt &&\n'> <'        grep "^ fileX |  *1 +$" diffstat.txt\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase -n overrides config rebase.stat config'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard start &&\n'> <'        git config rebase.stat true &&\n'> 
          <'        git rebase -n master >diffstat.txt &&\n'> <'        ! grep "^ fileX |  *1 +$" diffstat.txt\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase --onto outputs the invalid ref'>)} 
      {
        (SQ <'\n'> <'\ttest_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&\n'> 
          <'\ttest_i18ngrep "invalid-ref" err\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)