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

Re: git submodule ignores --git-dir

From
John Keeping <john@keeping.me.uk>
Date
Sep 11, 2015, 15:28 UTC
Message-ID
<20150911152807.GA17201@serenity.lan>
In-Reply-To
<55F2F028.7070505@web.de>
On Fri, Sep 11, 2015 at 05:15:52PM +0200, Jens Lehmann wrote:
Show 20 quoted lines
> Am 10.09.2015 um 22:06 schrieb Filip Gospodinov:
> > I know that for this particular use case I can just use `git clone --recursive`
> > and that other use cases can be worked around by using `cd`. Still, I wonder if
> > the behavior I discovered is a bug or if it's expected.
> 
> I don't think this is a bug. The git submodule command needs a work tree
> to read the .gitmodules file from, that's while it fails when using
> --git-dir from outside the work tree. But I admit that the error message
> "No submodule mapping found in .gitmodules for path ..." could be improved
> to clearly state that the .gitmodules file wasn't found.
> 
> Unfortunately trying to show git the right work tree:
> 
> $ git --git-dir=$PWD/repo2/.git --work-tree=$PWD/repo2 submodule update --init
> 
> Didn't work as I expected it to either:
> 
> fatal: /home/Sledge/libexec/git-core/git-submodule cannot be used without a working tree.
> 
> So you'll have to cd into the repo for now.

There's also "git -C /path/to/repo" which avoids the need for a separate "cd".

Previous: Jens LehmannNext: Filip Gospodinov
Message 3 of 4 in “git submodule ignores --git-dir”
  1. Filip GospodinovSep 10, 2015
  2. Jens LehmannSep 11, 2015
  3. John KeepingSep 11, 2015
  4. Filip GospodinovSep 14, 2015

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.