(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.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'> ) } ) ] ) (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'> ) } ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sub1sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(super/sub1)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sub3sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(super/sub3)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:pwd) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 137 stdin_parts: [ ("Entering 'sub1'\n") ($ VSub_DollarName '$pwd') (/clone-foo1-sub1-) ($ VSub_DollarName '$sub1sha1') ('\n') ("Entering 'sub3'\n") ($ VSub_DollarName '$pwd') (/clone-foo3-sub3-) ($ VSub_DollarName '$sub3sha1') ('\n') ] ) ] ) (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'> ) } ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 178 stdin_parts: [ ("Entering '../sub1'\n") ($ VSub_DollarName '$pwd') (/clone-foo1-../sub1-) ($ VSub_DollarName '$sub1sha1') ('\n') ("Entering '../sub3'\n") ($ VSub_DollarName '$pwd') (/clone-foo3-../sub3-) ($ VSub_DollarName '$sub3sha1') ('\n') ] ) ] ) (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'> ) } ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 301 stdin_parts: [ ("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") ] ) ] ) (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'> ) } ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 336 stdin_parts: [ ("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") ] ) ] ) (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'> ) } ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 373 stdin_parts: [ ('nested1-nested1\n') ('nested2-nested2\n') ('nested3-nested3\n') ('submodule-submodule\n') ('foo1-sub1\n') ('foo2-sub2\n') ('foo3-sub3\n') ] ) ] ) (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'> ) } ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:nested1sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(clone3/nested1)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:nested2sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(cd)} {(clone3/nested1/nested2)}) (C {(git)} {(rev-parse)} {(HEAD)}) ] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:nested3sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(cd)} {(clone3/nested1/nested2/nested3)}) (C {(git)} {(rev-parse)} {(HEAD)}) ] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:submodulesha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(cd)} {(clone3/nested1/nested2/nested3/submodule)}) (C {(git)} {(rev-parse)} {(HEAD)}) ] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sub1sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(clone3/sub1)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sub2sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(clone3/sub2)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sub3sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(clone3/sub3)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sub1sha1_short) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(cd)} {(clone3/sub1)}) (C {(git)} {(rev-parse)} {(--short)} {(HEAD)}) ] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sub2sha1_short) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(cd)} {(clone3/sub2)}) (C {(git)} {(rev-parse)} {(--short)} {(HEAD)}) ] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 593 stdin_parts: [ (' ') ($ VSub_DollarName '$nested1sha1') (' nested1 (heads/master)\n') (' ') ($ VSub_DollarName '$nested2sha1') (' nested1/nested2 (heads/master)\n') (' ') ($ VSub_DollarName '$nested3sha1') (' nested1/nested2/nested3 (heads/master)\n') (' ') ($ VSub_DollarName '$submodulesha1') (' nested1/nested2/nested3/submodule (heads/master)\n') (' ') ($ VSub_DollarName '$sub1sha1') (' sub1 (') ($ VSub_DollarName '$sub1sha1_short') (')\n') (' ') ($ VSub_DollarName '$sub2sha1') (' sub2 (') ($ VSub_DollarName '$sub2sha1_short') (')\n') (' ') ($ VSub_DollarName '$sub3sha1') (' sub3 (heads/master)\n') ] ) ] ) (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'> ) } ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 633 stdin_parts: [ (' ') ($ VSub_DollarName '$nested1sha1') (' nested1 (heads/master)\n') ('+') ($ VSub_DollarName '$nested2sha1') (' nested1/nested2 (file2~1)\n') (' ') ($ VSub_DollarName '$nested3sha1') (' nested1/nested2/nested3 (heads/master)\n') (' ') ($ VSub_DollarName '$submodulesha1') (' nested1/nested2/nested3/submodule (heads/master)\n') ] ) ] ) (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'> ) } ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:nested2sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(git)} {(-C)} {(clone3/nested1/nested2)} {(rev-parse)} {(HEAD)})] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 704 stdin_parts: [ (' ') ($ VSub_DollarName '$nested1sha1') (' ../nested1 (heads/master)\n') ('+') ($ VSub_DollarName '$nested2sha1') (' ../nested1/nested2 (file2)\n') (' ') ($ VSub_DollarName '$nested3sha1') (' ../nested1/nested2/nested3 (heads/master)\n') (' ') ($ VSub_DollarName '$submodulesha1') (' ../nested1/nested2/nested3/submodule (heads/master)\n') (' ') ($ VSub_DollarName '$sub1sha1') (' ../sub1 (') ($ VSub_DollarName '$sub1sha1_short') (')\n') (' ') ($ VSub_DollarName '$sub2sha1') (' ../sub2 (') ($ VSub_DollarName '$sub2sha1_short') (')\n') (' ') ($ VSub_DollarName '$sub3sha1') (' ../sub3 (heads/master)\n') ] ) ] ) (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)}) ] )