@matheusbsbs / matheus-bagliano / commits / e965647334
Fork 0

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>

Mark Levedahl committed Jul 7, 2008 at 22:36 UTC e9656473342e050494c8ea8416fdfdcf52fd1c93
1 file changed +1 -2
git-submodule.sh
+1 -2
@@ -167,8 +167,7 @@ cmd_add()
167 # perhaps the path exists and is already a git repo, else clone it
168 if test -e "$path"
169 then
170 - if test -d "$path/.git" &&
171 - test "$(unset GIT_DIR; cd $path; git rev-parse --git-dir)" = ".git"
170 + if test -d "$path"/.git -o -f "$path"/.git
171 then
172 echo "Adding existing repo at '$path' to the index"
173 else