git-submodule - Fix bugs in adding an existing repo as a module

git-submodule add would trip if path to the submodule included a space,
or if its .git was a gitdir: link to a GIT_DIR kept elsewhere. Fix both.

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-07 22:36:40 -04:00 committed by Junio C Hamano
parent d773c6314d
commit e965647334

View File

@ -167,8 +167,7 @@ cmd_add()
# perhaps the path exists and is already a git repo, else clone it
if test -e "$path"
then
if test -d "$path/.git" &&
test "$(unset GIT_DIR; cd $path; git rev-parse --git-dir)" = ".git"
if test -d "$path"/.git -o -f "$path"/.git
then
echo "Adding existing repo at '$path' to the index"
else