From: Jeff King <peff@peff.net>
To: "Vít Novotný" <witiko@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: `.git` symlink makes `git submodule add` fail
Date: Sat, 13 Feb 2016 13:52:52 -0500 [thread overview]
Message-ID: <20160213185252.GA10063@sigill.intra.peff.net> (raw)
In-Reply-To: <20160213042008.GA26677@witiko>
On Sat, Feb 13, 2016 at 05:20:09AM +0100, Vít Novotný wrote:
> On Fri, Feb 12, 2016 at 01:27:33PM -0500, Jeff King wrote:
> > On Fri, Feb 12, 2016 at 10:19:38AM -0800, Junio C Hamano wrote:
> >
> > > >> Is this a bug, or is the ability to symlink `.git` just a happy coincidence?
> > > >
> > > > It has never been supported.
> > >
> > > Oops, hit "send" too early.
> > >
> > > We have support for a "gitdir:" facility that would work even on a
> > > filesystem that cannot do symlinks (see gitrepository-layout(5)),
> > > and both the higher-level submodule Porcelain and the more recent
> > > "worktree" experimental code do use it.
> >
> > And the way to convince git to make the link for you is with clone's
> > "--separate-git-dir" option.
>
> What's curious is that this doesn't really work either, so the issue
> doesn't seem to be the lack of symlink support, but rather the lack of
> willingness on the part of Git to resolve a path recursively.
Right. The fundamental problem is that if git needs to construct a
related path, symlinks mean it cannot do so textually. I'm sure there
are spots where we use real_path() to get a canonical path for a
particular $GIT_DIR, but from your results, it's clear we don't do so
consistently.
So you can call that "git doesn't support symlinks", or you can call it
"git supports symlinks, but needs to do so more consistently". :) I am
not sure whether the existing uses of real_path() are there
intentionally to support the kind of path-munging that submodules do or
not. But either way, canonicalizing the paths before creating relative
ones is probably going to be the solution.
I say all of that without having really looked at the code. You asked
earlier if there would be any objects to a patch to implement better
symlink support. That is hard to answer without somebody digging in to
see what the fix would look like, and whether there would be any
tradeoffs.
-Peff
next prev parent reply other threads:[~2016-02-13 18:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 16:48 `.git` symlink makes `git submodule add` fail Vít Novotný
2016-02-12 18:09 ` Junio C Hamano
2016-02-12 18:19 ` Junio C Hamano
2016-02-12 18:27 ` Jeff King
2016-02-13 4:20 ` Vít Novotný
2016-02-13 18:52 ` Jeff King [this message]
2016-02-12 18:36 ` Vít Novotný
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160213185252.GA10063@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=witiko@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).