git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Collingbourne <peter@pcc.me.uk>
To: git@vger.kernel.org
Cc: Lars Hjemli <hjemli@gmail.com>, Peter Collingbourne <peter@pcc.me.uk>
Subject: [PATCH] Removed the .git/config check from "git submodule status"
Date: Wed, 13 Jan 2010 20:31:39 +0000	[thread overview]
Message-ID: <1263414699-1613-1-git-send-email-peter@pcc.me.uk> (raw)

"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

                 reply	other threads:[~2010-01-13 20:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263414699-1613-1-git-send-email-peter@pcc.me.uk \
    --to=peter@pcc.me.uk \
    --cc=git@vger.kernel.org \
    --cc=hjemli@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).