(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'Test rebasing, stashing, etc. with submodules'>)}
        )
      ]
    )
    (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.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(fake-editor.sh)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 91
          stdin_parts: [('#!/bin/sh\n') ('echo $EDITOR_TEXT\n')]
        )
      ]
    )
    (C {(chmod)} {(a) (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)})
  ]
)