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

[BUG] Fail to add a module in a subdirectory if module is already cloned

From
JBJehan Bing <jehan@orb.com>
Date
Jan 24, 2012, 19:11 UTC
Message-ID
<jfmvpp$4v7$1@dough.gmane.org>
Hi,

I'm getting an error if I try to add a module in a subdirectory and that module is already cloned. Here are the steps to reproduce (git 1.7.8.3):

git init module cd module echo foo > foo git add foo git commit -m "init" cd .. git init super cd super echo foo > foo git add foo git commit -m "init" git branch b1 git branch b2 git checkout b1 git submodule add ../module lib/module git commit -m "module" git checkout b2 rm -rf lib git submodule add ../module lib/module

The last command returns:
     fatal: Not a git repository: ../.git/modules/lib/module
     Unable to checkout submodule 'lib/module'
The file lib/modules/.git contains:
     gitdir: ../.git/modules/lib/module
(missing an additional "../")
In branch b1, after adding the module, the file contained the full path:
     gitdir: /[...]/super/.git/modules/lib/module
Or contains the correct relative path after checking out b1 later:
     gitdir: ../../.git/modules/lib/module
Regards,
	Jehan
Next: Jens Lehmann
Message 1 of 9 in “[BUG] Fail to add a module in a subdirectory if module is already cloned”
  1. Jehan BingJan 24, 2012
  2. Jens LehmannJan 24, 2012
  3. Jens LehmannJan 24, 2012
  4. Junio C HamanoJan 24, 2012
  5. Jens LehmannJan 24, 2012
  6. Jens LehmannJan 24, 2012
  7. Junio C HamanoJan 24, 2012
  8. submodule add: fix breakage when re-adding a deep submoduleJens Lehmann, Jan 24, 2012
  9. Jehan BingJan 25, 2012

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.