{"thread":{"id":"22207","subject":"[PATCH] Removed the .git/config check from \"git submodule status\"","startedAt":"2010-01-13T20:31:39Z","lastAt":"2010-01-13T20:31:39Z","messageCount":1,"participants":["Peter Collingbourne"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"131528","messageId":"1263414699-1613-1-git-send-email-peter@pcc.me.uk","threadId":"22207","inReplyTo":null,"subject":"[PATCH] Removed the .git/config check from \"git submodule status\"","fromName":"Peter Collingbourne","fromEmail":"peter@pcc.me.uk","sentAt":"2010-01-13T20:31:39Z","receivedAt":"2010-01-13T20:31:39Z","isPatch":true,"sender":{"key":"peter@pcc.me.uk","avatar":"https://avatars.githubusercontent.com/u/425024?v=4"},"body":"\"git submodule status\" requires that the following conditions be met\nfor a submodule to be considered initialised:\n\n1) The existence of an entry in .git/config for that module\n2) The existence of a .git subdirectory under the submodule directory\n\nPlumbing only requires condition 2 to be met, and does not care about\ncondition 1 (these entries being part of the git-submodule porcelain).\nTherefore removing condition 1 from \"git submodule status\" will make\ngit-submodule's view of the world consistent with plumbing's thus\neliminating unexpected behaviour.\n\nFurthermore if the user is using the git-submodule porcelain and\nnot cloning submodules himself, condition 1 should always follow\nfrom condition 2 because \"git submodule update\" requires that the\nsubmodule entry in .git/config be present.\n\nBy removing condition 1 we can also remove the call to module_name from\ncmd_status.  \"git submodule status\" will now work if the user is using\na submodule porcelain other than git-submodule, because module_name\nrequires that the .gitmodules file be maintained by git-submodule.\n\nSigned-off-by: Peter Collingbourne <peter@pcc.me.uk>\n---\n git-submodule.sh           |    4 +---\n t/t7400-submodule-basic.sh |    8 ++------\n 2 files changed, 3 insertions(+), 9 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 77d2232..811f001 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -738,10 +738,8 @@ cmd_status()\n \tmodule_list \"$@\" |\n \twhile read mode sha1 stage path\n \tdo\n-\t\tname=$(module_name \"$path\") || exit\n-\t\turl=$(git config submodule.\"$name\".url)\n \t\tdisplaypath=\"$prefix$path\"\n-\t\tif test -z \"$url\" || ! test -d \"$path\"/.git -o -f \"$path\"/.git\n+\t\tif ! test -d \"$path\"/.git -o -f \"$path\"/.git\n \t\tthen\n \t\t\tsay \"-$sha1 $displaypath\"\n \t\t\tcontinue;\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 1a4dc5f..c16fb14 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -106,12 +106,8 @@ test_expect_success 'submodule add with ./, /.. and // in path' '\n \t)\n '\n \n-test_expect_success 'status should fail for unmapped paths' '\n-\tif git submodule status\n-\tthen\n-\t\techo \"[OOPS] submodule status succeeded\"\n-\t\tfalse\n-\telif ! GIT_CONFIG=.gitmodules git config submodule.example.path init\n+test_expect_success 'mapping a path using git config' '\n+\tif ! GIT_CONFIG=.gitmodules git config submodule.example.path init\n \tthen\n \t\techo \"[OOPS] git config failed to update .gitmodules\"\n \t\tfalse\n-- \n1.6.5\n"}]}