{"thread":{"id":"47285","subject":"[PATCH] Tests: clean up submodule recursive helpers","startedAt":"2017-11-21T22:13:12Z","lastAt":"2017-11-21T22:13:12Z","messageCount":1,"participants":["Jonathan Tan"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"333176","messageId":"20171121221256.154741-1-jonathantanmy@google.com","threadId":"47285","inReplyTo":null,"subject":"[PATCH] Tests: clean up submodule recursive helpers","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2017-11-21T22:12:56Z","receivedAt":"2017-11-21T22:13:12Z","isPatch":true,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"This continues the work in commit d3b5a49 (\"Tests: clean up and document\nsubmodule helpers\", 2017-11-08).\n\nFactor out the commonalities from\ntest_submodule_switch_recursing_with_args() and\ntest_submodule_forced_switch_recursing_with_args() in\nlib-submodule-update.sh, and document their usage. Some tests differ\nslightly in their test assertions; I have used the superset of those\nassertions in that case.\n\nSigned-off-by: Jonathan Tan <jonathantanmy@google.com>\n---\nI checked my work by using a custom diff patch to \"anchor\" one line into\nnever appearing as a minus/plus in the diff, so that I could more\nclearly see the deletions and additions, then opening 3 terminals: one\nshowing the common part, one showing the non-forced part, and one\nshowing the forced part. I'll send that diff patch to the mailing list\nshortly [1].\n\n[1] With my diff patch, you can run:\nDIFF_ANCHOR=test_submodule_switch_recursing_with_args git show\n--patience --color-moved\n---\n t/lib-submodule-update.sh | 343 +++++++++++++++++-----------------------------\n 1 file changed, 125 insertions(+), 218 deletions(-)\n\ndiff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh\nindex bb94c2320..f39ec3095 100755\n--- a/t/lib-submodule-update.sh\n+++ b/t/lib-submodule-update.sh\n@@ -554,6 +554,10 @@ test_submodule_switch_common() {\n #  - if succeeds, once \"git submodule update\" is invoked, the contents of\n #    submodule directories are updated\n #\n+# If the command under test is known to not work with submodules in certain\n+# conditions, set the appropriate KNOWN_FAILURE_* variable used in the tests\n+# below to 1.\n+#\n # Use as follows:\n #\n # my_func () {\n@@ -622,19 +626,11 @@ test_submodule_forced_switch () {\n # - Removing a submodule with a git directory absorbs the submodules\n #   git directory first into the superproject.\n \n-test_submodule_switch_recursing_with_args () {\n-\tcmd_args=\"$1\"\n-\tcommand=\"git $cmd_args --recurse-submodules\"\n-\tRESULTDS=success\n-\tif test \"$KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS\" = 1\n-\tthen\n-\t\tRESULTDS=failure\n-\tfi\n-\tRESULTOI=success\n-\tif test \"$KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED\" = 1\n-\tthen\n-\t\tRESULTOI=failure\n-\tfi\n+# Internal function; use test_submodule_switch_recursing_with_args() or\n+# test_submodule_forced_switch_recursing_with_args() instead.\n+test_submodule_recursing_with_args_common() {\n+\tcommand=\"$1\"\n+\n \t######################### Appearing submodule #########################\n \t# Switching to a commit letting a submodule appear checks it out ...\n \ttest_expect_success \"$command: added submodule is checked out\" '\n@@ -648,7 +644,7 @@ test_submodule_switch_recursing_with_args () {\n \t\t\ttest_submodule_content sub1 origin/add_sub1\n \t\t)\n \t'\n-\t# ... ignoring an empty existing directory ...\n+\t# ... ignoring an empty existing directory.\n \ttest_expect_success \"$command: added submodule is checked out in empty dir\" '\n \t\tprolog &&\n \t\treset_work_tree_to_interested no_submodule &&\n@@ -661,34 +657,6 @@ test_submodule_switch_recursing_with_args () {\n \t\t\ttest_submodule_content sub1 origin/add_sub1\n \t\t)\n \t'\n-\t# ... unless there is an untracked file in its place.\n-\ttest_expect_success \"$command: added submodule doesn't remove untracked file with same name\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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'\n-\t# ... but an ignored file is fine.\n-\ttest_expect_$RESULTOI \"$command: added submodule removes an untracked ignored file\" '\n-\t\ttest_when_finished \"rm submodule_update/.git/info/exclude\" &&\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\techo sub1 >.git/info/exclude\n-\t\t\t$command add_sub1 &&\n-\t\t\ttest_superproject_content origin/add_sub1 &&\n-\t\t\ttest_submodule_content sub1 origin/add_sub1\n-\t\t)\n-\t'\n \t# Replacing a tracked file with a submodule produces a checked out submodule\n \ttest_expect_success \"$command: replace tracked file with submodule checks out submodule\" '\n \t\tprolog &&\n@@ -742,33 +710,6 @@ test_submodule_switch_recursing_with_args () {\n \t\t\ttest_git_directory_exists sub1\n \t\t)\n \t'\n-\t# Replacing a submodule with files in a directory must succeeds\n-\t# when the submodule is clean\n-\ttest_expect_$RESULTDS \"$command: replace submodule with a directory\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\t$command replace_sub1_with_directory &&\n-\t\t\ttest_superproject_content origin/replace_sub1_with_directory &&\n-\t\t\ttest_submodule_content sub1 origin/replace_sub1_with_directory\n-\t\t)\n-\t'\n-\t# ... absorbing a .git directory.\n-\ttest_expect_$RESULTDS \"$command: replace submodule containing a .git directory with a directory must absorb the git dir\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\trm -rf .git/modules &&\n-\t\t\t$command replace_sub1_with_directory &&\n-\t\t\ttest_superproject_content origin/replace_sub1_with_directory &&\n-\t\t\ttest_git_directory_exists sub1\n-\t\t)\n-\t'\n \n \t# Replacing it with a file ...\n \ttest_expect_success \"$command: replace submodule with a file\" '\n@@ -782,7 +723,11 @@ test_submodule_switch_recursing_with_args () {\n \t\t\ttest -f sub1\n \t\t)\n \t'\n-\n+\tRESULTDS=success\n+\tif test \"$KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS\" = 1\n+\tthen\n+\t\tRESULTDS=failure\n+\tfi\n \t# ... must check its local work tree for untracked files\n \ttest_expect_$RESULTDS \"$command: replace submodule with a file must fail with untracked files\" '\n \t\tprolog &&\n@@ -794,21 +739,7 @@ test_submodule_switch_recursing_with_args () {\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'\n-\n-\t# ... and ignored files are ignored\n-\ttest_expect_success \"$command: replace submodule with a file works ignores ignored files in submodule\" '\n-\t\ttest_when_finished \"rm submodule_update/.git/modules/sub1/info/exclude\" &&\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\t: >sub1/ignored &&\n-\t\t\t$command replace_sub1_with_file &&\n-\t\t\ttest_superproject_content origin/replace_sub1_with_file &&\n-\t\t\ttest -f sub1\n+\t\t\ttest -f sub1/untracked_file\n \t\t)\n \t'\n \n@@ -825,19 +756,6 @@ test_submodule_switch_recursing_with_args () {\n \t\t\ttest_submodule_content sub1 origin/modify_sub1\n \t\t)\n \t'\n-\n-\ttest_expect_success \"git -c submodule.recurse=true $cmd_args: modified submodule updates submodule work tree\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\tgit -c submodule.recurse=true $cmd_args modify_sub1 &&\n-\t\t\ttest_superproject_content origin/modify_sub1 &&\n-\t\t\ttest_submodule_content sub1 origin/modify_sub1\n-\t\t)\n-\t'\n-\n \t# Updating a submodule to an invalid sha1 doesn't update the\n \t# superproject nor the submodule's work tree.\n \ttest_expect_success \"$command: updating to a missing submodule commit fails\" '\n@@ -851,126 +769,166 @@ test_submodule_switch_recursing_with_args () {\n \t\t\ttest_submodule_content sub1 origin/add_sub1\n \t\t)\n \t'\n-\n-\t# recursing deeper than one level doesn't work yet.\n-\ttest_expect_success \"$command: modified submodule updates submodule recursively\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested add_nested_sub &&\n-\t\t(\n-\t\t\tcd submodule_update &&\n-\t\t\tgit branch -t modify_sub1_recursively origin/modify_sub1_recursively &&\n-\t\t\t$command modify_sub1_recursively &&\n-\t\t\ttest_superproject_content origin/modify_sub1_recursively &&\n-\t\t\ttest_submodule_content sub1 origin/modify_sub1_recursively &&\n-\t\t\ttest_submodule_content -C sub1 sub2 origin/modify_sub1_recursively\n-\t\t)\n-\t'\n }\n \n-# Test that submodule contents are updated when switching between commits\n-# that change a submodule, but throwing away local changes in\n-# the superproject as well as the submodule is allowed.\n-test_submodule_forced_switch_recursing_with_args () {\n+# Declares and invokes several tests that, in various situations, checks that\n+# the provided Git command, when invoked with --recurse-submodules:\n+#  - succeeds in updating the worktree and index of a superproject to a target\n+#    commit, or fails atomically (depending on the test situation)\n+#  - if succeeds, the contents of submodule directories are updated\n+#\n+# Specify the Git command so that \"git $GIT_COMMAND --recurse-submodules\"\n+# works.\n+#\n+# If the command under test is known to not work with submodules in certain\n+# conditions, set the appropriate KNOWN_FAILURE_* variable used in the tests\n+# below to 1.\n+#\n+# Use as follows:\n+#\n+# test_submodule_switch_recursing_with_args \"$GIT_COMMAND\"\n+test_submodule_switch_recursing_with_args () {\n \tcmd_args=\"$1\"\n \tcommand=\"git $cmd_args --recurse-submodules\"\n-\tRESULT=success\n+\ttest_submodule_recursing_with_args_common \"$command\"\n+\n+\tRESULTDS=success\n \tif test \"$KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS\" = 1\n \tthen\n-\t\tRESULT=failure\n+\t\tRESULTDS=failure\n \tfi\n-\t######################### Appearing submodule #########################\n-\t# Switching to a commit letting a submodule appear creates empty dir ...\n-\ttest_expect_success \"$command: added submodule is checked out\" '\n+\tRESULTOI=success\n+\tif test \"$KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED\" = 1\n+\tthen\n+\t\tRESULTOI=failure\n+\tfi\n+\t# Switching to a commit letting a submodule appear cannot override an\n+\t# untracked file.\n+\ttest_expect_success \"$command: added submodule doesn't remove untracked file with same name\" '\n \t\tprolog &&\n \t\treset_work_tree_to_interested 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_submodule_content 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'\n-\t# ... and doesn't care if it already exists ...\n-\ttest_expect_success \"$command: added submodule ignores empty directory\" '\n+\t# ... but an ignored file is fine.\n+\ttest_expect_$RESULTOI \"$command: added submodule removes an untracked ignored file\" '\n+\t\ttest_when_finished \"rm submodule_update/.git/info/exclude\" &&\n \t\tprolog &&\n \t\treset_work_tree_to_interested 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: >sub1 &&\n+\t\t\techo sub1 >.git/info/exclude\n \t\t\t$command add_sub1 &&\n \t\t\ttest_superproject_content origin/add_sub1 &&\n \t\t\ttest_submodule_content sub1 origin/add_sub1\n \t\t)\n \t'\n-\t# ... not caring about an untracked file either\n-\ttest_expect_success \"$command: added submodule does remove untracked unignored file with same name when forced\" '\n+\n+\t# Replacing a submodule with files in a directory must succeeds\n+\t# when the submodule is clean\n+\ttest_expect_$RESULTDS \"$command: replace submodule with a directory\" '\n \t\tprolog &&\n-\t\treset_work_tree_to_interested no_submodule &&\n+\t\treset_work_tree_to_interested add_sub1 &&\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_submodule_content sub1 origin/add_sub1\n+\t\t\tgit branch -t replace_sub1_with_directory origin/replace_sub1_with_directory &&\n+\t\t\t$command replace_sub1_with_directory &&\n+\t\t\ttest_superproject_content origin/replace_sub1_with_directory &&\n+\t\t\ttest_submodule_content sub1 origin/replace_sub1_with_directory\n \t\t)\n \t'\n-\t# Replacing a tracked file with a submodule checks out the submodule\n-\ttest_expect_success \"$command: replace tracked file with submodule populates the submodule\" '\n+\t# ... absorbing a .git directory.\n+\ttest_expect_$RESULTDS \"$command: replace submodule containing a .git directory with a directory must absorb the git dir\" '\n \t\tprolog &&\n-\t\treset_work_tree_to_interested replace_sub1_with_file &&\n+\t\treset_work_tree_to_interested add_sub1 &&\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_submodule_content sub1 origin/replace_file_with_sub1\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\trm -rf .git/modules &&\n+\t\t\t$command replace_sub1_with_directory &&\n+\t\t\ttest_superproject_content origin/replace_sub1_with_directory &&\n+\t\t\ttest_git_directory_exists sub1\n \t\t)\n \t'\n-\t# ... as does removing a directory with tracked files with a\n-\t# submodule.\n-\ttest_expect_success \"$command: replace directory with submodule\" '\n+\n+\t# ... and ignored files are ignored\n+\ttest_expect_success \"$command: replace submodule with a file works ignores ignored files in submodule\" '\n+\t\ttest_when_finished \"rm submodule_update/.git/modules/sub1/info/exclude\" &&\n \t\tprolog &&\n-\t\treset_work_tree_to_interested replace_sub1_with_directory &&\n+\t\treset_work_tree_to_interested add_sub1 &&\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_submodule_content sub1 origin/replace_directory_with_sub1\n+\t\t\tgit branch -t replace_sub1_with_file origin/replace_sub1_with_file &&\n+\t\t\t: >sub1/ignored &&\n+\t\t\t$command replace_sub1_with_file &&\n+\t\t\ttest_superproject_content origin/replace_sub1_with_file &&\n+\t\t\ttest -f sub1\n \t\t)\n \t'\n \n-\t######################## Disappearing submodule #######################\n-\t# Removing a submodule doesn't remove its work tree ...\n-\ttest_expect_success \"$command: removed submodule leaves submodule directory and its contents in place\" '\n+\ttest_expect_success \"git -c submodule.recurse=true $cmd_args: modified submodule updates submodule work tree\" '\n \t\tprolog &&\n \t\treset_work_tree_to_interested 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\t! test -e sub1\n+\t\t\tgit branch -t modify_sub1 origin/modify_sub1 &&\n+\t\t\tgit -c submodule.recurse=true $cmd_args modify_sub1 &&\n+\t\t\ttest_superproject_content origin/modify_sub1 &&\n+\t\t\ttest_submodule_content sub1 origin/modify_sub1\n \t\t)\n \t'\n-\t# ... especially when it contains a .git directory.\n-\ttest_expect_success \"$command: removed submodule leaves submodule containing a .git directory alone\" '\n+\n+\t# recursing deeper than one level doesn't work yet.\n+\ttest_expect_success \"$command: modified submodule updates submodule recursively\" '\n \t\tprolog &&\n-\t\treset_work_tree_to_interested add_sub1 &&\n+\t\treset_work_tree_to_interested add_nested_sub &&\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\trm -rf .git/modules/sub1 &&\n-\t\t\t$command remove_sub1 &&\n-\t\t\ttest_superproject_content origin/remove_sub1 &&\n-\t\t\ttest_git_directory_exists sub1 &&\n-\t\t\t! test -e sub1\n+\t\t\tgit branch -t modify_sub1_recursively origin/modify_sub1_recursively &&\n+\t\t\t$command modify_sub1_recursively &&\n+\t\t\ttest_superproject_content origin/modify_sub1_recursively &&\n+\t\t\ttest_submodule_content sub1 origin/modify_sub1_recursively &&\n+\t\t\ttest_submodule_content -C sub1 sub2 origin/modify_sub1_recursively\n+\t\t)\n+\t'\n+}\n+\n+# Same as test_submodule_switch_recursing_with_args(), except that throwing\n+# away local changes in the superproject is allowed.\n+test_submodule_forced_switch_recursing_with_args () {\n+\tcmd_args=\"$1\"\n+\tcommand=\"git $cmd_args --recurse-submodules\"\n+\ttest_submodule_recursing_with_args_common \"$command\"\n+\n+\tRESULT=success\n+\tif test \"$KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS\" = 1\n+\tthen\n+\t\tRESULT=failure\n+\tfi\n+\t# Switching to a commit letting a submodule appear does not care about\n+\t# an untracked file.\n+\ttest_expect_success \"$command: added submodule does remove untracked unignored file with same name when forced\" '\n+\t\tprolog &&\n+\t\treset_work_tree_to_interested 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_submodule_content sub1 origin/add_sub1\n \t\t)\n \t'\n+\n \t# Replacing a submodule with files in a directory ...\n \ttest_expect_success \"$command: replace submodule with a directory\" '\n \t\tprolog &&\n@@ -997,17 +955,6 @@ test_submodule_forced_switch_recursing_with_args () {\n \t\t\ttest_git_directory_exists sub1\n \t\t)\n \t'\n-\t# Replacing it with a file\n-\ttest_expect_success \"$command: replace submodule with a file\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\t$command replace_sub1_with_file &&\n-\t\t\ttest_superproject_content origin/replace_sub1_with_file\n-\t\t)\n-\t'\n \n \t# ... even if the submodule contains ignored files\n \ttest_expect_success \"$command: replace submodule with a file ignoring ignored files\" '\n@@ -1022,46 +969,6 @@ test_submodule_forced_switch_recursing_with_args () {\n \t\t)\n \t'\n \n-\t# ... but stops for untracked files that would be lost\n-\ttest_expect_$RESULT \"$command: replace submodule with a file stops for untracked files\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\t: >sub1/untracked_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 -f sub1/untracked_file\n-\t\t)\n-\t'\n-\n-\t########################## Modified submodule #########################\n-\t# Updating a submodule sha1 updates the submodule's work tree\n-\ttest_expect_success \"$command: modified submodule updates submodule work tree\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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/modify_sub1\n-\t\t)\n-\t'\n-\t# Updating a submodule to an invalid sha1 doesn't update the\n-\t# submodule's work tree, subsequent update will fail\n-\ttest_expect_success \"$command: modified submodule does not update submodule work tree to invalid commit\" '\n-\t\tprolog &&\n-\t\treset_work_tree_to_interested 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\ttest_must_fail $command invalid_sub1 &&\n-\t\t\ttest_superproject_content origin/add_sub1 &&\n-\t\t\ttest_submodule_content sub1 origin/add_sub1\n-\t\t)\n-\t'\n \t# Updating a submodule from an invalid sha1 updates\n \ttest_expect_success \"$command: modified submodule does update submodule work tree from invalid commit\" '\n \t\tprolog &&\n-- \n2.15.0.317.g14c63a9dc.dirty\n\n"}]}