1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 20:06:11 +02:00

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>
This commit is contained in:
Mark Levedahl 2008-07-09 21:05:41 -04:00 committed by Junio C Hamano
parent ec05df353c
commit c2f939170c

View File

@ -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