summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2011-06-06 21:58:04 +0200
committerJunio C Hamano <gitster@pobox.com>2011-06-06 13:46:36 -0700
commit4d689320049e1ff3bd31e0468d6f17eeb0b7029c (patch)
treeb3f96609e1df7afbb3640a8384721f39aa4098eb /git-submodule.sh
parent8537f0ef936781d3984491603cd1c8ff15d7a8a5 (diff)
downloadgit-4d689320049e1ff3bd31e0468d6f17eeb0b7029c.tar.gz
submodule add: allow relative repository path even when no url is set
Adding a submodule with a relative repository path did only succeed when the superproject's default remote was set. But when that is unset, the superproject is its own authoritative upstream, so lets use its working directory as upstream instead. This allows users to set up a new superpoject where the submodules urls are configured relative to the superproject's upstream while its default remote can be configured later. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 4361ae418c..0c984a8983 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -34,7 +34,7 @@ resolve_relative_url ()
{
remote=$(get_default_remote)
remoteurl=$(git config "remote.$remote.url") ||
- die "remote ($remote) does not have a url defined in .git/config"
+ remoteurl=$(pwd) # the repository is its own authoritative upstream
url="$1"
remoteurl=${remoteurl%/}
sep=/