[PATCH] Removed the .git/config check from "git submodule status"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]