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

Re: bug: git submodule add fails when .git is a symlink

From
Stefan Beller <sbeller@google.com>
Date
Mar 1, 2016, 21:49 UTC
Message-ID
<CAGZ79kbV9y6nDuBgqLbzQ=xaroG_uF8RF6gqzk=unJ-9rrtvfw@mail.gmail.com>
In-Reply-To
<CAGZ79kY6Lf6u0=s8J_cqRNFsry4nu2SdL0GZ2gkFsu6gBrB65Q@mail.gmail.com>
On Tue, Mar 1, 2016 at 1:39 PM, Stefan Beller <sbeller@google.com> wrote:
Show 12 quoted lines
> On Tue, Mar 1, 2016 at 12:42 PM, Joey Hess <id@joeyh.name> wrote:
>>         git init gitdir
>>         mkdir worktree
>>         cd worktree
>>         ln -s ../gitdir/.git .git
>>         git submodule add /any/git/repo sub
>>
>>         fatal: Could not chdir to '../../../sub': No such file or directory
>>
>> Fairly sure this is a bug..
>
> Which version(s) of Git do you use?
To elaborate on that: Starting in 2.7 parts of the submodule stuff
has been rewritten in C, in 2.8 even more and there is more in flight for
 > 2.8.

However your bug is also to be found in 2.6, which doesn't contain any recent rewrites, so it is a rather long standing bug, I would presume.

As a workaround for now:
    echo "gitdir: ../gitdir/.git" > .git

instead of the symbolic link in your example (works in 2.6 and also in 2.8.0-rc0)

Thanks, Stefan

Previous: Stefan BellerNext: Joey Hess
Message 3 of 9 in “bug: git submodule add fails when .git is a symlink”
  1. Joey HessMar 1, 2016
  2. Stefan BellerMar 1, 2016
  3. Stefan BellerMar 1, 2016
  4. Joey HessMar 1, 2016
  5. Junio C HamanoMar 1, 2016
  6. Joey HessMar 1, 2016
  7. Jeff KingMar 2, 2016
  8. Stefan BellerApr 20, 2016
  9. Stefan BellerApr 20, 2016

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.