From: Mark Levedahl Date: Thu, 10 Jul 2008 01:05:41 +0000 (-0400) Subject: git-submodule - register submodule URL if adding in place X-Git-Tag: v1.6.0-rc0~72 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c2f939170c65173076bbd752bb3c764536b3b09b;p=git.git git-submodule - register submodule URL if adding in place When adding a new submodule in place, meaning the user created the submodule as a git repo in the superproject's tree first, we don't go through "git submodule init" to register the module. Thus, the submodule's origin repository URL is not stored in .git/config, and no subsequent submodule operation will ever do so. In this case, assume the URL the user supplies to "submodule add" is the one that should be registered, and do so. Signed-off-by: Mark Levedahl Signed-off-by: Junio C Hamano --- diff --git a/git-submodule.sh b/git-submodule.sh index c2ce2fbe8..9228f56be 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -172,6 +172,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 module_clone "$path" "$realrepo" || exit