(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'Test rebasing, stashing, etc. with submodules'>)}
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\n'> <'\techo file > file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit commit -m initial &&\n'> <'\tgit clone . submodule &&\n'> <'\tgit add submodule &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit commit -m submodule &&\n'> <'\techo second line >> file &&\n'> <'\t(cd submodule && git pull) &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit commit -m file-and-submodule -a &&\n'> <'\tgit branch added-submodule\n'> <'\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase with a dirty submodule'>)} 
      {
        (SQ <'\n'> <'\n'> <'\t(cd submodule &&\n'> <'\t echo 3rd line >> file &&\n'> 
          <'\t test_tick &&\n'> <'\t git commit -m fork -a) &&\n'> <'\techo unrelated >> file2 &&\n'> <'\tgit add file2 &&\n'> 
          <'\ttest_tick &&\n'> <'\tgit commit -m unrelated file2 &&\n'> <'\techo other line >> file &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit commit -m update file &&\n'> <'\tCURRENT=$(cd submodule && git rev-parse HEAD) &&\n'> 
          <'\tEXPECTED=$(git rev-parse HEAD~2:submodule) &&\n'> <'\tGIT_TRACE=1 git rebase --onto HEAD~2 HEAD^ &&\n'> 
          <'\tSTORED=$(git rev-parse HEAD:submodule) &&\n'> <'\ttest $EXPECTED = $STORED &&\n'> <'\ttest $CURRENT = $(cd submodule && git rev-parse HEAD)\n'> 
          <'\n'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<fake-editor.sh>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 91
              stdin_parts: [<'#!/bin/sh\n'> <'echo $EDITOR_TEXT\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<chmod>} {<a> <Id.Lit_Other '+'> <x>} {<fake-editor.sh>})
    (C {<test_expect_success>} {(SQ <'interactive rebase with a dirty submodule'>)} 
      {
        (SQ <'\n'> <'\n'> <'\ttest submodule = $(git diff --name-only) &&\n'> 
          <'\tHEAD=$(git rev-parse HEAD) &&\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor.sh\\"" EDITOR_TEXT="pick $HEAD" \\\n'> 
          <'\t\tgit rebase -i HEAD^ &&\n'> <'\ttest submodule = $(git diff --name-only)\n'> <'\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebase with dirty file and submodule fails'>)} 
      {
        (SQ <'\n'> <'\n'> <'\techo yet another line >> file &&\n'> <'\ttest_tick &&\n'> 
          <'\tgit commit -m next file &&\n'> <'\techo rewrite > file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m rewrite file &&\n'> 
          <'\techo dirty > file &&\n'> <'\ttest_must_fail git rebase --onto HEAD~2 HEAD^\n'> <'\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'stash with a dirty submodule'>)} 
      {
        (SQ <'\n'> <'\n'> <'\techo new > file &&\n'> 
          <'\tCURRENT=$(cd submodule && git rev-parse HEAD) &&\n'> <'\tgit stash &&\n'> <'\ttest new != $(cat file) &&\n'> 
          <'\ttest submodule = $(git diff --name-only) &&\n'> <'\ttest $CURRENT = $(cd submodule && git rev-parse HEAD) &&\n'> <'\tgit stash apply &&\n'> 
          <'\ttest new = $(cat file) &&\n'> <'\ttest $CURRENT = $(cd submodule && git rev-parse HEAD)\n'> <'\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'rebasing submodule that should conflict'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout added-submodule &&\n'> 
          <'\tgit add submodule &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m third &&\n'> <'\t(\n'> <'\t\tcd submodule &&\n'> 
          <'\t\tgit commit --allow-empty -m extra\n'> <'\t) &&\n'> <'\tgit add submodule &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m fourth &&\n'> <'\n'> 
          <'\ttest_must_fail git rebase --onto HEAD^^ HEAD^ HEAD^0 &&\n'> <'\tgit ls-files -s submodule >actual &&\n'> <'\t(\n'> <'\t\tcd submodule &&\n'> 
          <'\t\techo "160000 $(git rev-parse HEAD^) 1\tsubmodule" &&\n'> <'\t\techo "160000 $(git rev-parse HEAD^^) 2\tsubmodule" &&\n'> 
          <'\t\techo "160000 $(git rev-parse HEAD) 3\tsubmodule"\n'> <'\t) >expect &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)