(command.CommandList children: [ (command.FuncDef name: create_lib_submodule_repo body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(git)} {(init)} {(submodule_update_repo)}) (command.Subshell child: (command.AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (C {(cd)} {(submodule_update_repo)}) (command.SimpleCommand words: [{(echo)} {(DQ (expect))}] redirects: [ (redir.Redir op: <Redir_DGreat '>>'> fd: 16777215 arg_word: {(.gitignore)} ) ] ) (command.SimpleCommand words: [{(echo)} {(DQ (actual))}] redirects: [ (redir.Redir op: <Redir_DGreat '>>'> fd: 16777215 arg_word: {(.gitignore)} ) ] ) (command.SimpleCommand words: [{(echo)} {(DQ (x))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file1)})] ) (command.SimpleCommand words: [{(echo)} {(DQ (y))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file2)})] ) (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: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(cd)} {(sub1)}) (C {(git)} {(fetch)}) (C {(git)} {(checkout)} {(-b)} {(DQ (modifications))}) (command.SimpleCommand words: [{(echo)} {(DQ (z))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(file2)} ) ] ) (command.SimpleCommand words: [{(echo)} {(DQ (x))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(file3)} ) ] ) (C {(git)} {(add)} {(file2)} {(file3)}) (C {(git)} {(commit)} {(-m)} {(DQ ('modified file2 and added file3'))}) (C {(git)} {(push)} {(origin)} {(modifications)}) ] ) spids: [341 428] ) (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: [Op_DAmp] children: [(C {(cd)} {(sub1)}) (C {(git)} {(checkout)} {(modifications)})] ) spids: [482 499] ) (C {(git)} {(rm)} {(--cached)} {(sub1)}) (C {(rm)} {(sub1/.git) (Lit_Other '*')}) (C {(git)} {(config)} {(-f)} {(.gitmodules)} {(--remove-section)} {(DQ (submodule.sub1))} ) (C {(git)} {(add)} {(.gitmodules)} {(sub1/) (Lit_Other '*')}) (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.SimpleCommand words: [{(echo)} {(DQ (content))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(sub1)})] ) (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)}) ] ) spids: [124 739] ) ] ) ] spids: [112] ) spids: [107 111] ) (command.FuncDef name: replace_gitfile_with_git_dir body: (command.BraceGroup children: [ (command.Subshell child: (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(cd)} {(DQ ($ VSub_Number '$1'))}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:git_dir spids:[767]) op: Equal rhs: { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(git)} {(rev-parse)} {(--git-dir)})] ) left_token: <Left_CommandSub '$('> spids: [769 775] ) ) } spids: [767] ) ] spids: [767] ) (C {(rm)} {(-f)} {(.git)}) (C {(cp)} {(-R)} {(DQ ($ VSub_Name '$git_dir'))} {(.git)}) (command.SimpleCommand words: [{(git)} {(config)} {(--unset)} {(core.worktree)}] more_env: [(env_pair name:GIT_WORK_TREE val:{(.)} spids:[803])] ) ] ) spids: [755 815] ) ] spids: [752] ) spids: [747 751] ) (command.FuncDef name: test_git_directory_is_unchanged body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (command.Subshell child: (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(cd)} {(DQ (.git/modules/) ($ VSub_Number '$1'))}) (C {(test)} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(git)} {(config)} {(core.worktree)})] ) left_token: <Left_CommandSub '$('> spids: [869 875] ) ) } {(Lit_Other '=')} {(DQ (../../../) ($ VSub_Number '$1'))} ) (C {(git)} {(config)} {(--unset)} {(core.worktree)}) ] ) spids: [849 905] ) (C {(diff)} {(-r)} {(DQ (.git/modules/) ($ VSub_Number '$1'))} {(DQ ($ VSub_Number '$1') (/.git))} ) (command.Subshell child: (command.AndOr ops: [Op_DAmp] children: [ (C {(cd)} {(DQ (.git/modules/) ($ VSub_Number '$1'))}) (C {(git)} {(config)} {(core.worktree)} {(DQ (../../../) ($ VSub_Number '$1'))}) ] ) spids: [927 956] ) ] ) ] spids: [846] ) spids: [841 845] ) (command.FuncDef name: prolog body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (command.Subshell child: (command.AndOr ops: [Op_DPipe] children: [ (C {(test)} {(-d)} {(submodule_update_repo)}) (C {(create_lib_submodule_repo)}) ] ) spids: [978 988] ) (C {(test_config_global)} {(diff.ignoreSubmodules)} {(all)}) (C {(test_config)} {(diff.ignoreSubmodules)} {(all)}) ] ) ] spids: [975] ) spids: [970 974] ) (command.FuncDef name: reset_work_tree_to body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(rm)} {(-rf)} {(submodule_update)}) (C {(git)} {(clone)} {(submodule_update_repo)} {(submodule_update)}) (command.Subshell child: (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(cd)} {(submodule_update)}) (C {(rm)} {(-rf)} {(sub1)}) (C {(git)} {(checkout)} {(-f)} {(DQ ($ VSub_Number '$1'))}) (command.SimpleCommand words: [{(git)} {(status)} {(-u)} {(-s)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(actual)} ) ] ) (C {(test_must_be_empty)} {(actual)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sha1 spids:[1101]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(--revs-only)} {(HEAD) (Lit_Other ':') (sub1)} ) ] ) left_token: <Left_CommandSub '$('> spids: [1102 1112] ) } spids: [1101] ) ] spids: [1101] ) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(test)} {(-n)} {(DQ ($ VSub_Name '$sha1'))}) (C {(test)} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(cd)} {(DQ (sub1))}) (C {(git)} {(rev-parse)} {(--verify)} {(DQ ($ VSub_Name '$sha1') ('^{commit}'))} ) ] ) ] ) left_token: <Left_CommandSub '$('> spids: [1132 1151] ) } ) ] ) ] action: [ (C {(git)} {(submodule)} {(update)} {(--init)} {(--recursive)} {(DQ (sub1))}) ] spids: [16777215 1154] ) ] spids: [16777215 1172] ) ] ) spids: [1048 1175] ) ] ) ] spids: [1025] ) spids: [1020 1024] ) (command.FuncDef name: test_superproject_content body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.SimpleCommand words: [{(git)} {(diff-index)} {(--cached)} {(DQ ($ VSub_Number '$1'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_must_be_empty)} {(actual)}) (command.SimpleCommand words: [{(git)} {(diff-files)} {(--ignore-submodules)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_must_be_empty)} {(actual)}) ] ) ] spids: [1194] ) spids: [1189 1193] ) (command.FuncDef name: test_submodule_content body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (command.If arms: [ (if_arm cond: [(C {(test)} {($ VSub_Pound '$#')} {(KW_Bang '!') (Lit_Other '=')} {(2)})] action: [ (C {(echo)} {(DQ ('test_submodule_content needs two arguments'))}) (command.ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] spids: [16777215 1265] ) ] spids: [16777215 1280] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:submodule spids:[1285]) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [1285] ) ] spids: [1285] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:commit spids:[1293]) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} spids: [1293] ) ] spids: [1293] ) (C {(test)} {(-d)} {(DQ ($ VSub_Name '$submodule')) (/)}) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Op_DAmp] children: [ (command.Pipeline children: [(C {(test)} {(-f)} {(DQ ($ VSub_Name '$submodule')) (/.git)})] negated: T ) (command.Pipeline children: [(C {(test)} {(-d)} {(DQ ($ VSub_Name '$submodule')) (/.git)})] negated: T ) ] ) ] action: [ (C {(echo)} {(DQ ('Submodule ') ($ VSub_Name '$submodule') (' is not populated'))} ) (command.ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] spids: [16777215 1340] ) ] spids: [16777215 1357] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sha1 spids:[1362]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(--verify)} {(DQ ($ VSub_Name '$commit') (':') ($ VSub_Name '$submodule'))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1363 1375] ) } spids: [1362] ) ] spids: [1362] ) (command.If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name '$sha1'))})] action: [ (C {(echo)} { (DQ ("Couldn't retrieve SHA-1 of ") ($ VSub_Name '$submodule') (' for ') ($ VSub_Name '$commit') ) } ) (command.ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] spids: [16777215 1391] ) ] spids: [16777215 1409] ) (command.Subshell child: (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(cd)} {(DQ ($ VSub_Name '$submodule'))}) (command.SimpleCommand words: [{(git)} {(status)} {(-u)} {(-s)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(actual)} ) ] ) (C {(test_must_be_empty)} {(actual)}) (command.SimpleCommand words: [{(git)} {(diff)} {(DQ ($ VSub_Name '$sha1'))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(actual)} ) ] ) (C {(test_must_be_empty)} {(actual)}) ] ) spids: [1414 1466] ) ] ) ] spids: [1250] ) spids: [1245 1249] ) (command.FuncDef name: test_submodule_switch body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:command spids:[1534]) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [1534] ) ] spids: [1534] ) (command.If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name '$KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES'))} {(Lit_Other '=')} {(1)} ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1568]) op: Equal rhs: {(DQ (failure))} spids: [1568] ) ] spids: [1568] ) ] spids: [16777215 1561] ) ] else_action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1577]) op: Equal rhs: {(DQ (success))} spids: [1577] ) ] spids: [1577] ) ] spids: [1574 1583] ) (C {(test_expect_) ($ VSub_Name '$RESULT')} {(DQ ($ VSub_Name '$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_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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 ($ VSub_Name '$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_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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 ($ VSub_Name '$KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR') ) } {(Lit_Other '=')} {(1)} ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1737]) op: Equal rhs: {(DQ (failure))} spids: [1737] ) ] spids: [1737] ) ] spids: [16777215 1722] ) ] else_action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1746]) op: Equal rhs: {(DQ (success))} spids: [1746] ) ] spids: [1746] ) ] spids: [1743 1752] ) (C {(test_expect_) ($ VSub_Name '$RESULT')} {(DQ ($ VSub_Name '$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 ($ VSub_Name '$KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES'))} {(Lit_Other '=')} {(1)} ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1805]) op: Equal rhs: {(DQ (failure))} spids: [1805] ) ] spids: [1805] ) ] spids: [16777215 1802] ) ] else_action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1814]) op: Equal rhs: {(DQ (success))} spids: [1814] ) ] spids: [1814] ) ] spids: [1811 1820] ) (C {(test_expect_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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 ($ VSub_Name '$KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES' ) ) } {(Lit_Other '=')} {(1)} ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1911]) op: Equal rhs: {(DQ (failure))} spids: [1911] ) ] spids: [1911] ) ] spids: [16777215 1896] ) ] else_action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[1920]) op: Equal rhs: {(DQ (success))} spids: [1920] ) ] spids: [1920] ) ] spids: [1917 1926] ) (C {(test_expect_) ($ VSub_Name '$RESULT')} {(DQ ($ VSub_Name '$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_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT'))} {(Lit_Other '=')} {(1)} ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[2080]) op: Equal rhs: {(DQ (failure))} spids: [2080] ) ] spids: [2080] ) ] spids: [16777215 2065] ) ] else_action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:RESULT spids:[2089]) op: Equal rhs: {(DQ (success))} spids: [2089] ) ] spids: [2089] ) ] spids: [2086 2095] ) (C {(test_expect_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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_) ($ VSub_Name '$RESULT')} { (DQ ($ VSub_Name '$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'> ) } ) ] spids: [1531] ) spids: [1526 1530] ) (command.FuncDef name: test_submodule_forced_switch body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:command spids:[2209]) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [2209] ) ] spids: [2209] ) (C {(test_expect_success)} {(DQ ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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 ($ VSub_Name '$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'> ) } ) ] spids: [2206] ) spids: [2201 2205] ) ] )