From: Mark Levedahl Date: Tue, 8 Jul 2008 02:36:40 +0000 (-0400) Subject: git-submodule - Fix bugs in adding an existing repo as a module X-Git-Tag: v1.5.6.3~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e9656473342e050494c8ea8416fdfdcf52fd1c93 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 Signed-off-by: Junio C Hamano --- diff --git a/git-submodule.sh b/git-submodule.sh index 3eb78cc724..099a7d7560 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -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