aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2008-07-07 22:36:40 -0400
committerJunio C Hamano <gitster@pobox.com>2008-07-08 16:37:25 -0700
commite9656473342e050494c8ea8416fdfdcf52fd1c93 (patch)
treef791f6555503695fc7684a6023015c3fc1163f39 /git-submodule.sh
parentd773c6314d5660266313772b3fd8a466c3dbc559 (diff)
downloadgit-e9656473342e050494c8ea8416fdfdcf52fd1c93.tar.gz
git-e9656473342e050494c8ea8416fdfdcf52fd1c93.tar.xz
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>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh3
1 files changed, 1 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 3eb78cc72..099a7d756 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