git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Removed the .git/config check from "git submodule status"
@ 2010-01-13 20:31 Peter Collingbourne
  0 siblings, 0 replies; only message in thread
From: Peter Collingbourne @ 2010-01-13 20:31 UTC (permalink / raw)
  To: git; +Cc: Lars Hjemli, Peter Collingbourne

"git submodule status" requires that the following conditions be met
for a submodule to be considered initialised:

1) The existence of an entry in .git/config for that module
2) The existence of a .git subdirectory under the submodule directory

Plumbing only requires condition 2 to be met, and does not care about
condition 1 (these entries being part of the git-submodule porcelain).
Therefore removing condition 1 from "git submodule status" will make
git-submodule's view of the world consistent with plumbing's thus
eliminating unexpected behaviour.

Furthermore if the user is using the git-submodule porcelain and
not cloning submodules himself, condition 1 should always follow
from condition 2 because "git submodule update" requires that the
submodule entry in .git/config be present.

By removing condition 1 we can also remove the call to module_name from
cmd_status.  "git submodule status" will now work if the user is using
a submodule porcelain other than git-submodule, because module_name
requires that the .gitmodules file be maintained by git-submodule.

Signed-off-by: Peter Collingbourne <peter@pcc.me.uk>
---
 git-submodule.sh           |    4 +---
 t/t7400-submodule-basic.sh |    8 ++------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 77d2232..811f001 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -738,10 +738,8 @@ cmd_status()
 	module_list "$@" |
 	while read mode sha1 stage path
 	do
-		name=$(module_name "$path") || exit
-		url=$(git config submodule."$name".url)
 		displaypath="$prefix$path"
-		if test -z "$url" || ! test -d "$path"/.git -o -f "$path"/.git
+		if ! test -d "$path"/.git -o -f "$path"/.git
 		then
 			say "-$sha1 $displaypath"
 			continue;
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 1a4dc5f..c16fb14 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -106,12 +106,8 @@ test_expect_success 'submodule add with ./, /.. and // in path' '
 	)
 '
 
-test_expect_success 'status should fail for unmapped paths' '
-	if git submodule status
-	then
-		echo "[OOPS] submodule status succeeded"
-		false
-	elif ! GIT_CONFIG=.gitmodules git config submodule.example.path init
+test_expect_success 'mapping a path using git config' '
+	if ! GIT_CONFIG=.gitmodules git config submodule.example.path init
 	then
 		echo "[OOPS] git config failed to update .gitmodules"
 		false
-- 
1.6.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-13 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 20:31 [PATCH] Removed the .git/config check from "git submodule status" Peter Collingbourne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).