(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git rebase --abort tests'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:work_dir)
          op: assign_op.Equal
          rhs: 
            {(DQ (command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<pwd>})) <'/test dir'>)}
          spids: [18]
        )
      ]
    )
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\tmkdir -p "$work_dir" &&\n'> <'\tcd "$work_dir" &&\n'> <'\tgit init &&\n'> 
          <'\techo a > a &&\n'> <'\tgit add a &&\n'> <'\tgit commit -m a &&\n'> <'\tgit branch to-rebase &&\n'> <'\n'> 
          <'\techo b > a &&\n'> <'\tgit commit -a -m b &&\n'> <'\techo c > a &&\n'> <'\tgit commit -a -m c &&\n'> <'\n'> 
          <'\tgit checkout to-rebase &&\n'> <'\techo d > a &&\n'> <'\tgit commit -a -m "merge should fail on this" &&\n'> <'\techo e > a &&\n'> 
          <'\tgit commit -a -m "merge should fail on this, too" &&\n'> <'\tgit branch pre-rebase\n'>
        )
      }
    )
    (command.ShFunction
      name: testrebase
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:type)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [62]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:dotest)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [66]
                )
              ]
            )
            (C {<test_expect_success>} {(DQ <rebase> ($ Id.VSub_DollarName '$type') <' --abort'>)} 
              {
                (SQ <'\n'> <'\t\tcd "$work_dir" &&\n'> 
                  <'\t\t# Clean up the state from the previous one\n'> <'\t\tgit reset --hard pre-rebase &&\n'> <'\t\ttest_must_fail git rebase$type master &&\n'> 
                  <'\t\ttest_path_is_dir "$dotest" &&\n'> <'\t\tgit rebase --abort &&\n'> 
                  <'\t\ttest $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&\n'> <'\t\ttest ! -d "$dotest"\n'> <'\t'>
                )
              }
            )
            (C {<test_expect_success>} 
              {(DQ <rebase> ($ Id.VSub_DollarName '$type') <' --abort after --skip'>)} 
              {
                (SQ <'\n'> <'\t\tcd "$work_dir" &&\n'> 
                  <'\t\t# Clean up the state from the previous one\n'> <'\t\tgit reset --hard pre-rebase &&\n'> <'\t\ttest_must_fail git rebase$type master &&\n'> 
                  <'\t\ttest_path_is_dir "$dotest" &&\n'> <'\t\ttest_must_fail git rebase --skip &&\n'> 
                  <'\t\ttest $(git rev-parse HEAD) = $(git rev-parse master) &&\n'> <'\t\tgit rebase --abort &&\n'> 
                  <'\t\ttest $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&\n'> <'\t\ttest ! -d "$dotest"\n'> <'\t'>
                )
              }
            )
            (C {<test_expect_success>} 
              {(DQ <rebase> ($ Id.VSub_DollarName '$type') <' --abort after --continue'>)} 
              {
                (SQ <'\n'> <'\t\tcd "$work_dir" &&\n'> 
                  <'\t\t# Clean up the state from the previous one\n'> <'\t\tgit reset --hard pre-rebase &&\n'> <'\t\ttest_must_fail git rebase$type master &&\n'> 
                  <'\t\ttest_path_is_dir "$dotest" &&\n'> <'\t\techo c > a &&\n'> <'\t\techo d >> a &&\n'> <'\t\tgit add a &&\n'> 
                  <'\t\ttest_must_fail git rebase --continue &&\n'> <'\t\ttest $(git rev-parse HEAD) != $(git rev-parse master) &&\n'> <'\t\tgit rebase --abort &&\n'> 
                  <'\t\ttest $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&\n'> <'\t\ttest ! -d "$dotest"\n'> <'\t'>
                )
              }
            )
            (C {<test_expect_success>} 
              {(DQ <rebase> ($ Id.VSub_DollarName '$type') <' --abort does not update reflog'>)} 
              {
                (SQ <'\n'> <'\t\tcd "$work_dir" &&\n'> 
                  <'\t\t# Clean up the state from the previous one\n'> <'\t\tgit reset --hard pre-rebase &&\n'> <'\t\tgit reflog show to-rebase > reflog_before &&\n'> 
                  <'\t\ttest_must_fail git rebase$type master &&\n'> <'\t\tgit rebase --abort &&\n'> <'\t\tgit reflog show to-rebase > reflog_after &&\n'> 
                  <'\t\ttest_cmp reflog_before reflog_after &&\n'> <'\t\trm reflog_before reflog_after\n'> <'\t'>
                )
              }
            )
            (C {<test_expect_success>} {(SQ <'rebase --abort can not be used with other options'>)} 
              {
                (SQ <'\n'> <'\t\tcd "$work_dir" &&\n'> 
                  <'\t\t# Clean up the state from the previous one\n'> <'\t\tgit reset --hard pre-rebase &&\n'> <'\t\ttest_must_fail git rebase$type master &&\n'> 
                  <'\t\ttest_must_fail git rebase -v --abort &&\n'> <'\t\ttest_must_fail git rebase --abort -v &&\n'> <'\t\tgit rebase --abort\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (C {<testrebase>} {(DQ )} {<'.git/rebase-apply'>})
    (C {<testrebase>} {(DQ <' --merge'>)} {<'.git/rebase-merge'>})
    (C {<test_done>})
  ]
)