git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Jul 8, 2008, 02:36 UTC
Message-ID
<1215484600-2660-1-git-send-email-mlevedahl@gmail.com>

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>
---
 git-submodule.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 3eb78cc..099a7d7 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
-- 
1.5.6.2.271.g73ad8
Message 1 of 1 in “git-submodule - Fix bugs in adding an existing repo as a module”
  1. git-submodule - Fix bugs in adding an existing repo as a moduleMark Levedahl, Jul 8, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.