Skip to content

Commit e965647

Browse files
mark987gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d773c63 commit e965647

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

git-submodule.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ cmd_add()
167167
# perhaps the path exists and is already a git repo, else clone it
168168
if test -e "$path"
169169
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
172171
then
173172
echo "Adding existing repo at '$path' to the index"
174173
else

0 commit comments

Comments
 (0)