From: David Turner <dturner@twopensource.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, David Turner <dturner@twitter.com>
Subject: Re: [PATCH v5 3/3] cat-file: add --follow-symlinks to --batch
Date: Tue, 12 May 2015 17:53:29 -0400 [thread overview]
Message-ID: <1431467609.16652.35.camel@ubuntu> (raw)
In-Reply-To: <xmqqiobxealk.fsf@gitster.dls.corp.google.com>
On Tue, 2015-05-12 at 14:42 -0700, Junio C Hamano wrote:
> David Turner <dturner@twopensource.com> writes:
>
> > On Tue, 2015-05-12 at 13:07 -0700, Junio C Hamano wrote:
> >> David Turner <dturner@twopensource.com> writes:
> >>
> >> >> * I am not sure if HEAD:link that points at HEAD:link should be
> >> >> reported as "missing". It may be better to report the original
> >> >> without any dereferencing just like a link that points at outside
> >> >> the tree? i.e. "symlink 4 LF link".
> >> >
> >> > Unfortunately, a symlink loop might include relative symlinks
> >> > (e.g. ../a). If we return a relative symlink, the user will
> >> > not be able to distinguish it from a non-loop, out-of-tree symlink. So
> >> > I think we may not return symlink 4 LF ../a for these cases.
> >>
> >> I do not follow. Let's start from a shared example.
> >>
> >> HEAD:sub/link is a symbolic link whose value is ../nextlink
> >> HEAD:nextlink is a symbolic link whose value is sub/link
> >>
> >> That's a loop. Now, I think what I am sugesting is
> >>
> >> $ git cat-file --batch-check --follow-symlinks <<\EOF
> >> HEAD:sub/link
> >> HEAD:nextlink
> >> EOF
> >> symlink ../nextlink
> >> symlink sub/link
> >>
> >> If you asked about sub/link and then got ../nextlink back, then
> >> isn't it clear for the reading script that it is about nextlink
> >> at the top-level? Why can't it tell it from out-of-tree link?
> >
> > Because maybe sub/link was actually a link to ../../nextlink.
>
> Then the output would have said "symlink ../../nextlink" and you can
> tell these two cases apart, no? Same for the other case.
No. Successfully resolved out-of-tree symlinks must be relative to the
tree root. Jeff King and I discussed this in the original RFC:
otherwise, after a chain of symlinks which might move you all over the
tree, you have no idea what "../" is relative to.
next prev parent reply other threads:[~2015-05-12 21:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 22:50 [PATCH v5 0/3] cat-file --follow-symlinks dturner
2015-05-11 22:50 ` [PATCH v5 1/3] tree-walk: learn get_tree_entry_follow_symlinks dturner
2015-05-12 17:29 ` Johannes Sixt
2015-05-11 22:50 ` [PATCH v5 2/3] sha1_name: get_sha1_with_context learns to follow symlinks dturner
2015-05-11 22:50 ` [PATCH v5 3/3] cat-file: add --follow-symlinks to --batch dturner
2015-05-12 17:34 ` Johannes Sixt
2015-05-12 18:07 ` Junio C Hamano
2015-05-12 18:36 ` David Turner
2015-05-12 18:43 ` Junio C Hamano
2015-05-12 18:55 ` David Turner
2015-05-12 20:00 ` Junio C Hamano
2015-05-12 20:22 ` Junio C Hamano
2015-05-12 22:36 ` David Turner
2015-05-12 23:02 ` Junio C Hamano
2015-05-12 23:06 ` Junio C Hamano
2015-05-12 20:07 ` Junio C Hamano
2015-05-12 21:37 ` David Turner
2015-05-12 21:42 ` Junio C Hamano
2015-05-12 21:53 ` David Turner [this message]
2015-05-14 20:06 ` Junio C Hamano
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=1431467609.16652.35.camel@ubuntu \
--to=dturner@twopensource.com \
--cc=dturner@twitter.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).