git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Levedahl <mlevedahl@gmail.com>
To: git@vger.kernel.org
Cc: Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH] git-submodule - Fix bugs in adding an existing repo as a module
Date: Mon,  7 Jul 2008 22:36:40 -0400	[thread overview]
Message-ID: <1215484600-2660-1-git-send-email-mlevedahl@gmail.com> (raw)

git-submodule add would trip if path to the submodule included a space,
or if its .git was a gitdir: link to a GIT_DIR kept elsewhere. Fix both.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 git-submodule.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 3eb78cc..099a7d7 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -167,8 +167,7 @@ cmd_add()
 	# perhaps the path exists and is already a git repo, else clone it
 	if test -e "$path"
 	then
-		if test -d "$path/.git" &&
-		test "$(unset GIT_DIR; cd $path; git rev-parse --git-dir)" = ".git"
+		if test -d "$path"/.git -o -f "$path"/.git
 		then
 			echo "Adding existing repo at '$path' to the index"
 		else
-- 
1.5.6.2.271.g73ad8

                 reply	other threads:[~2008-07-08  2:38 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=1215484600-2660-1-git-send-email-mlevedahl@gmail.com \
    --to=mlevedahl@gmail.com \
    --cc=git@vger.kernel.org \
    /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).