Git development
 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 - register module url if adding in place
Date: Mon,  7 Jul 2008 22:37:10 -0400	[thread overview]
Message-ID: <1215484630-3784-1-git-send-email-mlevedahl@gmail.com> (raw)

When adding a new submodule in place, meaning the user created the
submodule as a git repo in the tree first, we don't go through
git submodule init to register the module. Thus, the url is
not stored in .git/config, and no git operation will ever do so. In
this case, assume the url the user supplies to git add is the one
that should be registered, and do so.

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

diff --git a/git-submodule.sh b/git-submodule.sh
index 099a7d7..7525922 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -173,6 +173,16 @@ cmd_add()
 		else
 			die "'$path' already exists and is not a valid git repo"
 		fi
+
+		case "$repo" in
+		./*|../*)
+			url=$(resolve_relative_url "$repo") || exit
+		    ;;
+		*)
+			url="$repo"
+			;;
+		esac
+		git config submodule."$path".url "$url"
 	else
 		case "$repo" in
 		./*|../*)
-- 
1.5.6.2.271.g73ad8

             reply	other threads:[~2008-07-08  2:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-08  2:37 Mark Levedahl [this message]
2008-07-08 11:34 ` [PATCH] git-submodule - register module url if adding in place Johannes Schindelin
2008-07-08 23:59   ` Mark Levedahl
2008-07-09  0:11     ` Johannes Schindelin

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=1215484630-3784-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