(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:16777215 arg_word:{(expect)} spids:[119]) (HereDoc op_id: Redir_DLess fd: 16777215 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:16777215 arg_word:{(expect)} spids:[160]) (HereDoc op_id: Redir_DLess fd: 16777215 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: [163] ) ] ) (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:16777215 arg_word:{(expect)} spids:[284]) (HereDoc op_id: Redir_DLess fd: 16777215 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: [288] ) ] ) (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:16777215 arg_word:{(expect)} spids:[318]) (HereDoc op_id: Redir_DLess fd: 16777215 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: [322] ) ] ) (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:16777215 arg_word:{(expect)} spids:[354]) (HereDoc op_id: Redir_DLess fd: 16777215 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: [358] ) ] ) (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: [414 426] ) } spids: [413] ) ] spids: [413] ) (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: [429 441] ) } spids: [428] ) ] spids: [428] ) (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: [444 456] ) } spids: [443] ) ] spids: [443] ) (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: [459 471] ) } spids: [458] ) ] spids: [458] ) (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: [474 486] ) } spids: [473] ) ] spids: [473] ) (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: [489 501] ) } spids: [488] ) ] spids: [488] ) (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: [504 516] ) } spids: [503] ) ] spids: [503] ) (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: [519 533] ) } spids: [518] ) ] spids: [518] ) (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: [536 550] ) } spids: [535] ) ] spids: [535] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:16777215 arg_word:{(expect)} spids:[555]) (HereDoc op_id: Redir_DLess fd: 16777215 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: [559] ) ] ) (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:16777215 arg_word:{(expect)} spids:[607]) (HereDoc op_id: Redir_DLess fd: 16777215 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: [611] ) ] ) (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: [649 659] ) } spids: [648] ) ] spids: [648] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:16777215 arg_word:{(expect)} spids:[664]) (HereDoc op_id: Redir_DLess fd: 16777215 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: [668] ) ] ) (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)}) ] )