(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: 
            {
              (SQ <"Test \"git submodule foreach\"\n"> <"\n"> 
                <
"This test verifies that \"git submodule foreach\" correctly visits all submodules\n"
                > <"that are currently checked out.\n">
              )
            }
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ <"setup a submodule tree">)} 
      {
        (SQ <"\n"> <"\techo file > file &&\n"> <"\tgit add file &&\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -m upstream &&\n"> <"\tgit clone . super &&\n"> <"\tgit clone super submodule &&\n"> <"\t(\n"> <"\t\tcd super &&\n"> 
          <"\t\tgit submodule add ../submodule sub1 &&\n"> <"\t\tgit submodule add ../submodule sub2 &&\n"> <"\t\tgit submodule add ../submodule sub3 &&\n"> 
          <"\t\tgit config -f .gitmodules --rename-section \\\n"> <"\t\t\tsubmodule.sub1 submodule.foo1 &&\n"> <"\t\tgit config -f .gitmodules --rename-section \\\n"> 
          <"\t\t\tsubmodule.sub2 submodule.foo2 &&\n"> <"\t\tgit config -f .gitmodules --rename-section \\\n"> <"\t\t\tsubmodule.sub3 submodule.foo3 &&\n"> 
          <"\t\tgit add .gitmodules &&\n"> <"\t\ttest_tick &&\n"> <"\t\tgit commit -m \"submodules\" &&\n"> <"\t\tgit submodule init sub1 &&\n"> 
          <"\t\tgit submodule init sub2 &&\n"> <"\t\tgit submodule init sub3\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd submodule &&\n"> 
          <"\t\techo different > file &&\n"> <"\t\tgit add file &&\n"> <"\t\ttest_tick &&\n"> <"\t\tgit commit -m \"different\"\n"> <"\t) &&\n"> 
          <"\t(\n"> <"\t\tcd super &&\n"> <"\t\t(\n"> <"\t\t\tcd sub3 &&\n"> <"\t\t\tgit pull\n"> <"\t\t) &&\n"> 
          <"\t\tgit add sub3 &&\n"> <"\t\ttest_tick &&\n"> <"\t\tgit commit -m \"update sub3\"\n"> <"\t)\n">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sub1sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [(C {(cd)} {(super/sub1)}) (C {(git)} {(rev-parse)} {(HEAD)})]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [81 93]
              )
            }
          spids: [80]
        )
      ]
      spids: [80]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sub3sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [(C {(cd)} {(super/sub3)}) (C {(git)} {(rev-parse)} {(HEAD)})]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [96 108]
              )
            }
          spids: [95]
        )
      ]
      spids: [95]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:pwd)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(pwd)})])
                left_token: <Left_CommandSub "$(">
                spids: [112 114]
              )
            }
          spids: [111]
        )
      ]
      spids: [111]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[119])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("Entering 'sub1'\n") ($ VSub_Name "$pwd") (/clone-foo1-sub1-) 
                ($ VSub_Name "$sub1sha1") ("\n") ("Entering 'sub3'\n") ($ VSub_Name "$pwd") (/clone-foo3-sub3-) ($ VSub_Name "$sub3sha1") ("\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [123]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"test basic \"submodule foreach\" usage">)} 
      {
        (SQ <"\n"> <"\tgit clone super clone &&\n"> <"\t(\n"> <"\t\tcd clone &&\n"> 
          <"\t\tgit submodule update --init -- sub1 sub3 &&\n"> <"\t\tgit submodule foreach \"echo \\$toplevel-\\$name-\\$path-\\$sha1\" > ../actual &&\n"> 
          <"\t\tgit config foo.bar zar &&\n"> <"\t\tgit submodule foreach \"git config --file \\\"\\$toplevel/.git/config\\\" foo.bar\"\n"> 
          <"\t) &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[159])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("Entering '../sub1'\n") ($ VSub_Name "$pwd") (/clone-foo1-../sub1-) 
                ($ VSub_Name "$sub1sha1") ("\n") ("Entering '../sub3'\n") ($ VSub_Name "$pwd") (/clone-foo3-../sub3-) ($ VSub_Name "$sub3sha1") 
                ("\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [162]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"test \"submodule foreach\" from subdirectory">)} 
      {
        (SQ <"\n"> <"\tmkdir clone/sub &&\n"> <"\t(\n"> <"\t\tcd clone/sub &&\n"> 
          <
"\t\tgit submodule foreach \"echo \\$toplevel-\\$name-\\$sm_path-\\$sha1\" >../../actual\n"
          > <"\t) &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"setup nested submodules">)} 
      {
        (SQ <"\n"> <"\tgit clone submodule nested1 &&\n"> <"\tgit clone submodule nested2 &&\n"> 
          <"\tgit clone submodule nested3 &&\n"> <"\t(\n"> <"\t\tcd nested3 &&\n"> <"\t\tgit submodule add ../submodule submodule &&\n"> 
          <"\t\ttest_tick &&\n"> <"\t\tgit commit -m \"submodule\" &&\n"> <"\t\tgit submodule init submodule\n"> <"\t) &&\n"> <"\t(\n"> 
          <"\t\tcd nested2 &&\n"> <"\t\tgit submodule add ../nested3 nested3 &&\n"> <"\t\ttest_tick &&\n"> 
          <"\t\tgit commit -m \"nested3\" &&\n"> <"\t\tgit submodule init nested3\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd nested1 &&\n"> 
          <"\t\tgit submodule add ../nested2 nested2 &&\n"> <"\t\ttest_tick &&\n"> <"\t\tgit commit -m \"nested2\" &&\n"> <"\t\tgit submodule init nested2\n"> 
          <"\t) &&\n"> <"\t(\n"> <"\t\tcd super &&\n"> <"\t\tgit submodule add ../nested1 nested1 &&\n"> <"\t\ttest_tick &&\n"> 
          <"\t\tgit commit -m \"nested1\" &&\n"> <"\t\tgit submodule init nested1\n"> <"\t)\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"use \"submodule foreach\" to checkout 2nd level submodule">)} 
      {
        (SQ <"\n"> <"\tgit clone super clone2 &&\n"> <"\t(\n"> <"\t\tcd clone2 &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub1/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub2/.git &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub3/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir nested1/.git &&\n"> 
          <"\t\tgit submodule update --init &&\n"> <"\t\tgit rev-parse --resolve-git-dir sub1/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir sub2/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir sub3/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir nested1/nested2/.git &&\n"> 
          <"\t\tgit submodule foreach \"git submodule update --init\" &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/.git &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir nested1/nested2/nested3/.git\n"> <"\t)\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"use \"foreach --recursive\" to checkout all submodules">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone2 &&\n"> 
          <"\t\tgit submodule foreach --recursive \"git submodule update --init\" &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/submodule/.git\n"> <"\t)\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[282])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("Entering 'nested1'\n") ("Entering 'nested1/nested2'\n") 
                ("Entering 'nested1/nested2/nested3'\n") ("Entering 'nested1/nested2/nested3/submodule'\n") ("Entering 'sub1'\n") ("Entering 'sub2'\n") 
                ("Entering 'sub3'\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [286]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"test messages from \"foreach --recursive\"">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone2 &&\n"> 
          <"\t\tgit submodule foreach --recursive \"true\" > ../actual\n"> <"\t) &&\n"> <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[315])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("Entering '../nested1'\n") ("Entering '../nested1/nested2'\n") 
                ("Entering '../nested1/nested2/nested3'\n") ("Entering '../nested1/nested2/nested3/submodule'\n") ("Entering '../sub1'\n") ("Entering '../sub2'\n") 
                ("Entering '../sub3'\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [319]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"test messages from \"foreach --recursive\" from subdirectory">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone2 &&\n"> <"\t\tmkdir untracked &&\n"> 
          <"\t\tcd untracked &&\n"> <"\t\tgit submodule foreach --recursive >../../actual\n"> <"\t) &&\n"> 
          <"\ttest_i18ncmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[350])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("nested1-nested1\n") ("nested2-nested2\n") ("nested3-nested3\n") 
                ("submodule-submodule\n") ("foo1-sub1\n") ("foo2-sub2\n") ("foo3-sub3\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [354]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"test \"foreach --quiet --recursive\"">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone2 &&\n"> 
          <"\t\tgit submodule foreach -q --recursive \"echo \\$name-\\$path\" > ../actual\n"> <"\t) &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"use \"update --recursive\" to checkout all submodules">)} 
      {
        (SQ <"\n"> <"\tgit clone super clone3 &&\n"> <"\t(\n"> <"\t\tcd clone3 &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub1/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub2/.git &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub3/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir nested1/.git &&\n"> 
          <"\t\tgit submodule update --init --recursive &&\n"> <"\t\tgit rev-parse --resolve-git-dir sub1/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir sub2/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir sub3/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/submodule/.git\n"> <"\t)\n">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:nested1sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [(C {(cd)} {(clone3/nested1)}) (C {(git)} {(rev-parse)} {(HEAD)})]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [409 421]
              )
            }
          spids: [408]
        )
      ]
      spids: [408]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:nested2sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (C {(cd)} {(clone3/nested1/nested2)})
                          (C {(git)} {(rev-parse)} {(HEAD)})
                        ]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [424 436]
              )
            }
          spids: [423]
        )
      ]
      spids: [423]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:nested3sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (C {(cd)} {(clone3/nested1/nested2/nested3)})
                          (C {(git)} {(rev-parse)} {(HEAD)})
                        ]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [439 451]
              )
            }
          spids: [438]
        )
      ]
      spids: [438]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:submodulesha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (C {(cd)} {(clone3/nested1/nested2/nested3/submodule)})
                          (C {(git)} {(rev-parse)} {(HEAD)})
                        ]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [454 466]
              )
            }
          spids: [453]
        )
      ]
      spids: [453]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sub1sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [(C {(cd)} {(clone3/sub1)}) (C {(git)} {(rev-parse)} {(HEAD)})]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [469 481]
              )
            }
          spids: [468]
        )
      ]
      spids: [468]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sub2sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [(C {(cd)} {(clone3/sub2)}) (C {(git)} {(rev-parse)} {(HEAD)})]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [484 496]
              )
            }
          spids: [483]
        )
      ]
      spids: [483]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sub3sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [(C {(cd)} {(clone3/sub3)}) (C {(git)} {(rev-parse)} {(HEAD)})]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [499 511]
              )
            }
          spids: [498]
        )
      ]
      spids: [498]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sub1sha1_short)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (C {(cd)} {(clone3/sub1)})
                          (C {(git)} {(rev-parse)} {(--short)} {(HEAD)})
                        ]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [514 528]
              )
            }
          spids: [513]
        )
      ]
      spids: [513]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sub2sha1_short)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (C {(cd)} {(clone3/sub2)})
                          (C {(git)} {(rev-parse)} {(--short)} {(HEAD)})
                        ]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [531 545]
              )
            }
          spids: [530]
        )
      ]
      spids: [530]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[550])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ (" ") ($ VSub_Name "$nested1sha1") (" nested1 (heads/master)\n") (" ") 
                ($ VSub_Name "$nested2sha1") (" nested1/nested2 (heads/master)\n") (" ") ($ VSub_Name "$nested3sha1") 
                (" nested1/nested2/nested3 (heads/master)\n") (" ") ($ VSub_Name "$submodulesha1") (" nested1/nested2/nested3/submodule (heads/master)\n") (" ") 
                ($ VSub_Name "$sub1sha1") (" sub1 (") ($ VSub_Name "$sub1sha1_short") (")\n") (" ") ($ VSub_Name "$sub2sha1") (" sub2 (") 
                ($ VSub_Name "$sub2sha1_short") (")\n") (" ") ($ VSub_Name "$sub3sha1") (" sub3 (heads/master)\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [554]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"test \"status --recursive\"">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone3 &&\n"> 
          <"\t\tgit submodule status --recursive > ../actual\n"> <"\t) &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[601])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ (" ") ($ VSub_Name "$nested1sha1") (" nested1 (heads/master)\n") ("+") 
                ($ VSub_Name "$nested2sha1") (" nested1/nested2 (file2~1)\n") (" ") ($ VSub_Name "$nested3sha1") 
                (" nested1/nested2/nested3 (heads/master)\n") (" ") ($ VSub_Name "$submodulesha1") (" nested1/nested2/nested3/submodule (heads/master)\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [605]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ <"ensure \"status --cached --recursive\" preserves the --cached flag">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone3 &&\n"> <"\t\t(\n"> <"\t\t\tcd nested1/nested2 &&\n"> 
          <"\t\t\ttest_commit file2\n"> <"\t\t) &&\n"> <"\t\tgit submodule status --cached --recursive -- nested1 > ../actual\n"> <"\t) &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:nested2sha1)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [(C {(git)} {(-C)} {(clone3/nested1/nested2)} {(rev-parse)} {(HEAD)})]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [642 652]
              )
            }
          spids: [641]
        )
      ]
      spids: [641]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[657])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ (" ") ($ VSub_Name "$nested1sha1") (" ../nested1 (heads/master)\n") ("+") 
                ($ VSub_Name "$nested2sha1") (" ../nested1/nested2 (file2)\n") (" ") ($ VSub_Name "$nested3sha1") 
                (" ../nested1/nested2/nested3 (heads/master)\n") (" ") ($ VSub_Name "$submodulesha1") (" ../nested1/nested2/nested3/submodule (heads/master)\n") (" ") 
                ($ VSub_Name "$sub1sha1") (" ../sub1 (") ($ VSub_Name "$sub1sha1_short") (")\n") (" ") ($ VSub_Name "$sub2sha1") (" ../sub2 (") 
                ($ VSub_Name "$sub2sha1_short") (")\n") (" ") ($ VSub_Name "$sub3sha1") (" ../sub3 (heads/master)\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: True
          spids: [661]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"test \"status --recursive\" from sub directory">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone3 &&\n"> <"\t\tmkdir tmp && cd tmp &&\n"> 
          <"\t\tgit submodule status --recursive > ../../actual\n"> <"\t) &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"use \"git clone --recursive\" to checkout all submodules">)} 
      {
        (SQ <"\n"> <"\tgit clone --recursive super clone4 &&\n"> <"\t(\n"> <"\t\tcd clone4 &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir .git &&\n"> <"\t\tgit rev-parse --resolve-git-dir sub1/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir sub2/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir sub3/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/submodule/.git\n"> <"\t)\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"test \"update --recursive\" with a flag with spaces">)} 
      {
        (SQ <"\n"> <"\tgit clone super \"common objects\" &&\n"> <"\tgit clone super clone5 &&\n"> 
          <"\t(\n"> <"\t\tcd clone5 &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir d nested1/.git &&\n"> 
          <
"\t\tgit submodule update --init --recursive --reference=\"$(dirname \"$PWD\")/common objects\" &&\n"
          > <"\t\tgit rev-parse --resolve-git-dir nested1/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/.git &&\n"> 
          <"\t\ttest -f .git/modules/nested1/objects/info/alternates &&\n"> <"\t\ttest -f .git/modules/nested1/modules/nested2/objects/info/alternates &&\n"> 
          <
"\t\ttest -f .git/modules/nested1/modules/nested2/modules/nested3/objects/info/alternates\n"
          > <"\t)\n">
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <"use \"update --recursive nested1\" to checkout all submodules rooted in nested1">)} 
      {
        (SQ <"\n"> <"\tgit clone super clone6 &&\n"> <"\t(\n"> <"\t\tcd clone6 &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub1/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub2/.git &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub3/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir nested1/.git &&\n"> 
          <"\t\tgit submodule update --init --recursive -- nested1 &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub1/.git &&\n"> 
          <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub2/.git &&\n"> <"\t\ttest_must_fail git rev-parse --resolve-git-dir sub3/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/.git &&\n"> 
          <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/.git &&\n"> <"\t\tgit rev-parse --resolve-git-dir nested1/nested2/nested3/submodule/.git\n"> <"\t)\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"command passed to foreach retains notion of stdin">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd super &&\n"> 
          <"\t\tgit submodule foreach echo success >../expected &&\n"> 
          <
"\t\tyes | git submodule foreach \"read y && test \\\"x\\$y\\\" = xy && echo success\" >../actual\n"
          > <"\t) &&\n"> <"\ttest_cmp expected actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"command passed to foreach --recursive retains notion of stdin">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd clone2 &&\n"> 
          <"\t\tgit submodule foreach --recursive echo success >../expected &&\n"> 
          <
"\t\tyes | git submodule foreach --recursive \"read y && test \\\"x\\$y\\\" = xy && echo success\" >../actual\n"
          > <"\t) &&\n"> <"\ttest_cmp expected actual\n">
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <"multi-argument command passed to foreach is not shell-evaluated twice">)} 
      {
        (SQ <"\n"> <"\t(\n"> <"\t\tcd super &&\n"> 
          <"\t\tgit submodule foreach \"echo \\\\\\\"quoted\\\\\\\"\" > ../expected &&\n"> <"\t\tgit submodule foreach echo \\\"quoted\\\" > ../actual\n"> <"\t) &&\n"> 
          <"\ttest_cmp expected actual\n">
        )
      }
    )
    (C {(test_done)})
  ]
)