aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2008-07-09 21:05:41 -0400
committerJunio C Hamano <gitster@pobox.com>2008-07-14 23:35:32 -0700
commitc2f939170c65173076bbd752bb3c764536b3b09b (patch)
treef46dc6c90c527f4a1808201a15c0bfca139b2d99 /git-submodule.sh
parentec05df353c594f2afc6509831d3ce145856b0b89 (diff)
downloadgit-c2f939170c65173076bbd752bb3c764536b3b09b.tar.gz
git-c2f939170c65173076bbd752bb3c764536b3b09b.tar.xz
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 <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh10
1 files changed, 10 insertions, 0 deletions
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