(command.CommandList children: [ (command.ShFunction name: create_lib_submodule_repo body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<git>} {<init>} {<submodule_update_repo>}) (command.Subshell child: (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<cd>} {<submodule_update_repo>}) (command.Simple words: [{<echo>} {(DQ <expect>)}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<.gitignore>} ) ] do_fork: T ) (command.Simple words: [{<echo>} {(DQ <actual>)}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<.gitignore>} ) ] do_fork: T ) (command.Simple words: [{<echo>} {(DQ <x>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<file1>} ) ] do_fork: T ) (command.Simple words: [{<echo>} {(DQ <y>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<file2>} ) ] do_fork: T ) (C {<git>} {<add>} {<.gitignore>} {<file1>} {<file2>}) (C {<git>} {<commit>} {<-m>} {(DQ <Base>)}) (C {<git>} {<branch>} {(DQ <no_submodule>)}) (C {<git>} {<checkout>} {<-b>} {(DQ <add_sub1>)}) (C {<git>} {<submodule>} {<add>} {<'./.'>} {<sub1>}) (C {<git>} {<config>} {<-f>} {<.gitmodules>} {<submodule.sub1.ignore>} {<all>}) (C {<git>} {<config>} {<submodule.sub1.ignore>} {<all>}) (C {<git>} {<add>} {<.gitmodules>}) (C {<git>} {<commit>} {<-m>} {(DQ <'Add sub1'>)}) (C {<git>} {<checkout>} {<-b>} {<remove_sub1>}) (C {<git>} {<revert>} {<HEAD>}) (C {<git>} {<checkout>} {<-b>} {(DQ <modify_sub1>)} {(DQ <add_sub1>)}) (C {<git>} {<submodule>} {<update>}) (command.Subshell child: (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<cd>} {<sub1>}) (C {<git>} {<fetch>}) (C {<git>} {<checkout>} {<-b>} {(DQ <modifications>)}) (command.Simple words: [{<echo>} {(DQ <z>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<file2>} ) ] do_fork: T ) (command.Simple words: [{<echo>} {(DQ <x>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<file3>} ) ] do_fork: T ) (C {<git>} {<add>} {<file2>} {<file3>}) (C {<git>} {<commit>} {<-m>} {(DQ <'modified file2 and added file3'>)}) (C {<git>} {<push>} {<origin>} {<modifications>}) ] ) ) (C {<git>} {<add>} {<sub1>}) (C {<git>} {<commit>} {<-m>} {(DQ <'Modify sub1'>)}) (C {<git>} {<checkout>} {<-b>} {(DQ <replace_sub1_with_directory>)} {(DQ <add_sub1>)} ) (C {<git>} {<submodule>} {<update>}) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp] children: [(C {<cd>} {<sub1>}) (C {<git>} {<checkout>} {<modifications>})] ) ) (C {<git>} {<rm>} {<--cached>} {<sub1>}) (C {<rm>} {<'sub1/.git'> <Id.Lit_Star '*'>}) (C {<git>} {<config>} {<-f>} {<.gitmodules>} {<--remove-section>} {(DQ <submodule.sub1>)} ) (C {<git>} {<add>} {<.gitmodules>} {<'sub1/'> <Id.Lit_Star '*'>}) (C {<git>} {<commit>} {<-m>} {(DQ <'Replace sub1 with directory'>)}) (C {<git>} {<checkout>} {<-b>} {<replace_directory_with_sub1>}) (C {<git>} {<revert>} {<HEAD>}) (C {<git>} {<checkout>} {<-b>} {(DQ <replace_sub1_with_file>)} {(DQ <add_sub1>)}) (C {<git>} {<rm>} {<sub1>}) (command.Simple words: [{<echo>} {(DQ <content>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<sub1>} ) ] do_fork: T ) (C {<git>} {<add>} {<sub1>}) (C {<git>} {<commit>} {<-m>} {(DQ <'Replace sub1 with file'>)}) (C {<git>} {<checkout>} {<-b>} {<replace_file_with_sub1>}) (C {<git>} {<revert>} {<HEAD>}) (C {<git>} {<checkout>} {<-b>} {(DQ <invalid_sub1>)} {(DQ <add_sub1>)}) (C {<git>} {<update-index>} {<--cacheinfo>} {<160000>} {<0123456789012345678901234567890123456789>} {<sub1>} ) (C {<git>} {<commit>} {<-m>} {(DQ <'Invalid sub1 commit'>)}) (C {<git>} {<checkout>} {<-b>} {<valid_sub1>}) (C {<git>} {<revert>} {<HEAD>}) (C {<git>} {<checkout>} {<master>}) ] ) ) ] ) ] ) ) (command.ShFunction name: replace_gitfile_with_git_dir body: (BraceGroup children: [ (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {(DQ ($ Id.VSub_Number '$1'))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:git_dir) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<--git-dir>}) ) ) } spids: [759] ) ] ) (C {<rm>} {<-f>} {<.git>}) (C {<cp>} {<-R>} {(DQ ($ Id.VSub_DollarName '$git_dir'))} {<.git>}) (command.Simple words: [{<git>} {<config>} {<--unset>} {<core.worktree>}] more_env: [(env_pair name:GIT_WORK_TREE val:{<.>} spids:[795])] do_fork: T ) ] ) ) ] ) ) (command.ShFunction name: test_git_directory_is_unchanged body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {(DQ <'.git/modules/'> ($ Id.VSub_Number '$1'))}) (C {<test>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<config>} {<core.worktree>}) ) ) } {<Id.Lit_Equals '='>} {(DQ <'../../../'> ($ Id.VSub_Number '$1'))} ) (C {<git>} {<config>} {<--unset>} {<core.worktree>}) ] ) ) (C {<diff>} {<-r>} {(DQ <'.git/modules/'> ($ Id.VSub_Number '$1'))} {(DQ ($ Id.VSub_Number '$1') <'/.git'>)} ) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<cd>} {(DQ <'.git/modules/'> ($ Id.VSub_Number '$1'))}) (C {<git>} {<config>} {<core.worktree>} {(DQ <'../../../'> ($ Id.VSub_Number '$1'))} ) ] ) ) ] ) ] ) ) (command.ShFunction name: prolog body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Subshell child: (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<test>} {<-d>} {<submodule_update_repo>}) (C {<create_lib_submodule_repo>}) ] ) ) (C {<test_config_global>} {<diff.ignoreSubmodules>} {<all>}) (C {<test_config>} {<diff.ignoreSubmodules>} {<all>}) ] ) ] ) ) (command.ShFunction name: reset_work_tree_to body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<rm>} {<-rf>} {<submodule_update>}) (C {<git>} {<clone>} {<submodule_update_repo>} {<submodule_update>}) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {<submodule_update>}) (C {<rm>} {<-rf>} {<sub1>}) (C {<git>} {<checkout>} {<-f>} {(DQ ($ Id.VSub_Number '$1'))}) (command.Simple words: [{<git>} {<status>} {<-u>} {<-s>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<actual>} ) ] do_fork: T ) (C {<test_must_be_empty>} {<actual>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<--revs-only>} {<HEAD> <Id.Lit_Colon ':'> <sub1>} ) ) } spids: [1093] ) ] ) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test>} {<-n>} {(DQ ($ Id.VSub_DollarName '$sha1'))}) (C {<test>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<cd>} {(DQ <sub1>)}) (C {<git>} {<rev-parse>} {<--verify>} {(DQ ($ Id.VSub_DollarName '$sha1') <'^{commit}'>)} ) ] ) ) } ) ] ) ] action: [ (C {<git>} {<submodule>} {<update>} {<--init>} {<--recursive>} {(DQ <sub1>)}) ] spids: [1109 1146] ) ] ) ] ) ) ] ) ] ) ) (command.ShFunction name: test_superproject_content body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<git>} {<diff-index>} {<--cached>} {(DQ ($ Id.VSub_Number '$1'))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_must_be_empty>} {<actual>}) (command.Simple words: [{<git>} {<diff-files>} {<--ignore-submodules>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_must_be_empty>} {<actual>}) ] ) ] ) ) (command.ShFunction name: test_submodule_content body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.If arms: [ (if_arm cond: [ (C {<test>} {($ Id.VSub_Pound '$#')} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<2>}) ] action: [ (C {<echo>} {(DQ <'test_submodule_content needs two arguments'>)}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] spids: [1245 1257] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:submodule) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [1277] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commit) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [1285] ) ] ) (C {<test>} {<-d>} {(DQ ($ Id.VSub_DollarName '$submodule')) <'/'>}) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Pipeline children: [ (C {<test>} {<-f>} {(DQ ($ Id.VSub_DollarName '$submodule')) <'/.git'>}) ] negated: T ) (command.Pipeline children: [ (C {<test>} {<-d>} {(DQ ($ Id.VSub_DollarName '$submodule')) <'/.git'>}) ] negated: T ) ] ) ] action: [ (C {<echo>} { (DQ <'Submodule '> ($ Id.VSub_DollarName '$submodule') <' is not populated'> ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] spids: [1305 1332] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<--verify>} { (DQ ($ Id.VSub_DollarName '$commit') <':'> ($ Id.VSub_DollarName '$submodule') ) } ) ) } spids: [1354] ) ] ) (command.If arms: [ (if_arm cond: [(C {<test>} {<-z>} {(DQ ($ Id.VSub_DollarName '$sha1'))})] action: [ (C {<echo>} { (DQ <'Couldn\'t retrieve SHA-1 of '> ($ Id.VSub_DollarName '$submodule') <' for '> ($ Id.VSub_DollarName '$commit') ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] spids: [1372 1383] ) ] ) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {(DQ ($ Id.VSub_DollarName '$submodule'))}) (command.Simple words: [{<git>} {<status>} {<-u>} {<-s>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<actual>} ) ] do_fork: T ) (C {<test_must_be_empty>} {<actual>}) (command.Simple words: [{<git>} {<diff>} {(DQ ($ Id.VSub_DollarName '$sha1'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<actual>} ) ] do_fork: T ) (C {<test_must_be_empty>} {<actual>}) ] ) ) ] ) ] ) ) (command.ShFunction name: test_submodule_switch body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:command) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [1526] ) ] ) (command.If arms: [ (if_arm cond: [ (C {<test>} { (DQ ($ Id.VSub_DollarName '$KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES') ) } {<Id.Lit_Equals '='>} {<1>} ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <failure>)} spids: [1560] ) ] ) ] spids: [1540 1553] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <success>)} spids: [1569] ) ] ) ] ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} {(DQ ($ Id.VSub_DollarName '$command') <': added submodule creates empty directory'>)} { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to no_submodule &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t add_sub1 origin/add_sub1 &&\n'> <'\t\t\t$command add_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': added submodule leaves existing empty directory alone'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to no_submodule &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tmkdir sub1 &&\n'> <'\t\t\tgit branch -t add_sub1 origin/add_sub1 &&\n'> <'\t\t\t$command add_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': added submodule doesn\'t remove untracked unignored file with same name'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to no_submodule &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t add_sub1 origin/add_sub1 &&\n'> <'\t\t\t>sub1 &&\n'> <'\t\t\ttest_must_fail $command add_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/no_submodule &&\n'> <'\t\t\ttest_must_be_empty sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': replace tracked file with submodule creates empty directory'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to replace_sub1_with_file &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_file_with_sub1 origin/replace_file_with_sub1 &&\n'> <'\t\t\t$command replace_file_with_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/replace_file_with_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/replace_file_with_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (command.If arms: [ (if_arm cond: [ (C {<test>} { (DQ ($ Id.VSub_DollarName '$KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR' ) ) } {<Id.Lit_Equals '='>} {<1>} ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <failure>)} spids: [1729] ) ] ) ] spids: [1701 1714] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <success>)} spids: [1738] ) ] ) ] ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} {(DQ ($ Id.VSub_DollarName '$command') <': replace directory with submodule'>)} { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to replace_sub1_with_directory &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> < '\t\t\tgit branch -t replace_directory_with_sub1 origin/replace_directory_with_sub1 &&\n' > <'\t\t\t$command replace_directory_with_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/replace_directory_with_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/replace_directory_with_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (command.If arms: [ (if_arm cond: [ (C {<test>} { (DQ ($ Id.VSub_DollarName '$KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES') ) } {<Id.Lit_Equals '='>} {<1>} ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <failure>)} spids: [1797] ) ] ) ] spids: [1781 1794] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <success>)} spids: [1806] ) ] ) ] ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': removed submodule leaves submodule directory and its contents in place'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t remove_sub1 origin/remove_sub1 &&\n'> <'\t\t\t$command remove_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/remove_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': removed submodule leaves submodule containing a .git directory alone'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t remove_sub1 origin/remove_sub1 &&\n'> <'\t\t\treplace_gitfile_with_git_dir sub1 &&\n'> <'\t\t\t$command remove_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/remove_sub1 &&\n'> <'\t\t\ttest_git_directory_is_unchanged sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (command.If arms: [ (if_arm cond: [ (C {<test>} { (DQ ($ Id.VSub_DollarName '$KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES' ) ) } {<Id.Lit_Equals '='>} {<1>} ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <failure>)} spids: [1903] ) ] ) ] spids: [1875 1888] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <success>)} spids: [1912] ) ] ) ] ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': replace submodule with a directory must fail'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_directory origin/replace_sub1_with_directory &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_directory &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': replace submodule containing a .git directory with a directory must fail'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_directory origin/replace_sub1_with_directory &&\n'> <'\t\t\treplace_gitfile_with_git_dir sub1 &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_directory &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_git_directory_is_unchanged sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_failure>} {(DQ ($ Id.VSub_DollarName '$command') <': replace submodule with a file must fail'>)} { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_file origin/replace_sub1_with_file &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_file &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_failure>} { (DQ ($ Id.VSub_DollarName '$command') <': replace submodule containing a .git directory with a file must fail'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_file origin/replace_sub1_with_file &&\n'> <'\t\t\treplace_gitfile_with_git_dir sub1 &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_file &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_git_directory_is_unchanged sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (command.If arms: [ (if_arm cond: [ (C {<test>} {(DQ ($ Id.VSub_DollarName '$KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT'))} {<Id.Lit_Equals '='>} {<1>} ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <failure>)} spids: [2072] ) ] ) ] spids: [2044 2057] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RESULT) op: assign_op.Equal rhs: {(DQ <success>)} spids: [2081] ) ] ) ] ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': modified submodule does not update submodule work tree'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t modify_sub1 origin/modify_sub1 &&\n'> <'\t\t\t$command modify_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/modify_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1 &&\n'> <'\t\t\tgit submodule update &&\n'> <'\t\t\ttest_submodule_content sub1 origin/modify_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': modified submodule does not update submodule work tree to invalid commit'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t invalid_sub1 origin/invalid_sub1 &&\n'> <'\t\t\t$command invalid_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/invalid_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1 &&\n'> <'\t\t\ttest_must_fail git submodule update &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_> ($ Id.VSub_DollarName '$RESULT')} { (DQ ($ Id.VSub_DollarName '$command') <': modified submodule does not update submodule work tree from invalid commit'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to invalid_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t valid_sub1 origin/valid_sub1 &&\n'> <'\t\t\t$command valid_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/valid_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/valid_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) ] ) ) (command.ShFunction name: test_submodule_forced_switch body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:command) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [2201] ) ] ) (C {<test_expect_success>} {(DQ ($ Id.VSub_DollarName '$command') <': added submodule creates empty directory'>)} { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to no_submodule &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t add_sub1 origin/add_sub1 &&\n'> <'\t\t\t$command add_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': added submodule leaves existing empty directory alone'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to no_submodule &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t add_sub1 origin/add_sub1 &&\n'> <'\t\t\tmkdir sub1 &&\n'> <'\t\t\t$command add_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') < ': added submodule does remove untracked unignored file with same name when forced' > ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to no_submodule &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t add_sub1 origin/add_sub1 &&\n'> <'\t\t\t>sub1 &&\n'> <'\t\t\t$command add_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': replace tracked file with submodule creates empty directory'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to replace_sub1_with_file &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_file_with_sub1 origin/replace_file_with_sub1 &&\n'> <'\t\t\t$command replace_file_with_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/replace_file_with_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/replace_file_with_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ ($ Id.VSub_DollarName '$command') <': replace directory with submodule'>)} { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to replace_sub1_with_directory &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> < '\t\t\tgit branch -t replace_directory_with_sub1 origin/replace_directory_with_sub1 &&\n' > <'\t\t\t$command replace_directory_with_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/replace_directory_with_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/replace_directory_with_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': removed submodule leaves submodule directory and its contents in place'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t remove_sub1 origin/remove_sub1 &&\n'> <'\t\t\t$command remove_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/remove_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': removed submodule leaves submodule containing a .git directory alone'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t remove_sub1 origin/remove_sub1 &&\n'> <'\t\t\treplace_gitfile_with_git_dir sub1 &&\n'> <'\t\t\t$command remove_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/remove_sub1 &&\n'> <'\t\t\ttest_git_directory_is_unchanged sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_failure>} { (DQ ($ Id.VSub_DollarName '$command') <': replace submodule with a directory must fail'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_directory origin/replace_sub1_with_directory &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_directory &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_failure>} { (DQ ($ Id.VSub_DollarName '$command') <': replace submodule containing a .git directory with a directory must fail'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_directory origin/replace_sub1_with_directory &&\n'> <'\t\t\treplace_gitfile_with_git_dir sub1 &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_directory &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_git_directory_is_unchanged sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_failure>} {(DQ ($ Id.VSub_DollarName '$command') <': replace submodule with a file must fail'>)} { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_file origin/replace_sub1_with_file &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_file &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_failure>} { (DQ ($ Id.VSub_DollarName '$command') <': replace submodule containing a .git directory with a file must fail'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t replace_sub1_with_file origin/replace_sub1_with_file &&\n'> <'\t\t\treplace_gitfile_with_git_dir sub1 &&\n'> <'\t\t\ttest_must_fail $command replace_sub1_with_file &&\n'> <'\t\t\ttest_superproject_content origin/add_sub1 &&\n'> <'\t\t\ttest_git_directory_is_unchanged sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': modified submodule does not update submodule work tree'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t modify_sub1 origin/modify_sub1 &&\n'> <'\t\t\t$command modify_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/modify_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1 &&\n'> <'\t\t\tgit submodule update &&\n'> <'\t\t\ttest_submodule_content sub1 origin/modify_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': modified submodule does not update submodule work tree to invalid commit'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to add_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t invalid_sub1 origin/invalid_sub1 &&\n'> <'\t\t\t$command invalid_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/invalid_sub1 &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1 &&\n'> <'\t\t\ttest_must_fail git submodule update &&\n'> <'\t\t\ttest_submodule_content sub1 origin/add_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ ($ Id.VSub_DollarName '$command') <': modified submodule does not update submodule work tree from invalid commit'> ) } { (SQ <'\n'> <'\t\tprolog &&\n'> <'\t\treset_work_tree_to invalid_sub1 &&\n'> <'\t\t(\n'> <'\t\t\tcd submodule_update &&\n'> <'\t\t\tgit branch -t valid_sub1 origin/valid_sub1 &&\n'> <'\t\t\t$command valid_sub1 &&\n'> <'\t\t\ttest_superproject_content origin/valid_sub1 &&\n'> <'\t\t\ttest_dir_is_empty sub1 &&\n'> <'\t\t\tgit submodule update --init --recursive &&\n'> <'\t\t\ttest_submodule_content sub1 origin/valid_sub1\n'> <'\t\t)\n'> <'\t'> ) } ) ] ) ) ] )