From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: David Turner <dturner@twopensource.com>,
git mailing list <git@vger.kernel.org>
Subject: Re: RFC: git cat-file --follow-symlinks?
Date: Wed, 29 Apr 2015 18:31:22 -0700 [thread overview]
Message-ID: <xmqq7fsu4d1x.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150430011612.GA7530@peff.net> (Jeff King's message of "Wed, 29 Apr 2015 21:16:12 -0400")
Jeff King <peff@peff.net> writes:
> I had imagined we would stop resolution and you would just get the last
> object peeled object. Combined with teaching cat-file to show more
> object context, doing:
>
> echo content >dest ;# actual blob
> ln -s dest link ;# link to blob
> ln -s broken foo ;# broken link
> ln -s out ../foo ;# out-of-tree link
> git add . && git commit -m foo
> for i in link broken out; do
> echo HEAD^{resolve}:$i
> done |
> git cat-file --batch="%(intreemode) %(size)"
>
> would yield:
>
> (1) 100644 8
> content
> (2) 040000 3
> foo
> (3) 040000 6
> ../foo
>
> where the left-margin numbers are for reference:
>
> 1. We dereference a real symlink, and pretend like we actually asked
> for its referent.
>
> 2. For a broken link, we can't dereference, so we return the link
> itself. You can tell by the mode, and the content tells you what
> would have been dereferenced.
>
> 3. Ditto for out-of-tree. Note that this would be the _raw_ symlink
> contents, not any kind of simplification (so if you asked for
> "foo/bar/baz" and it was "../../../../out", you would the full path
> with all those dots, not a simplified "../out", which I think is
> what you were trying to show in earlier examples).
s/040000/160000/ I would think (if you really meant to expose a
tree, write it as 40000 instead, so that people will not get a wrong
impression and reimplement a broken tree object encoding some popular
Git hosting site broke their customer projects with ;-).
I am not sure $treeish^{resolve} is a great syntax, but I like the
concept and agree that it is a lot more sensible to handle this at
the level of sha1_name.c layer than an ad-hoc solution in the
cat-file layer.
next prev parent reply other threads:[~2015-04-30 1:31 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 20:57 RFC: git cat-file --follow-symlinks? David Turner
2015-04-29 21:16 ` Jonathan Nieder
2015-04-29 21:24 ` David Turner
2015-04-29 21:17 ` Junio C Hamano
2015-04-29 21:30 ` David Turner
2015-04-29 21:48 ` Jeff King
2015-04-29 22:19 ` Jonathan Nieder
2015-04-29 23:05 ` Jeff King
2015-04-29 22:29 ` David Turner
2015-04-29 23:11 ` Jeff King
2015-04-30 0:37 ` Jeff King
2015-04-30 1:06 ` David Turner
2015-04-30 1:16 ` Jeff King
2015-04-30 1:31 ` Junio C Hamano [this message]
2015-04-30 3:18 ` Jeff King
2015-04-30 1:45 ` David Turner
2015-04-30 3:37 ` Jeff King
2015-04-30 5:34 ` Junio C Hamano
2015-04-30 8:12 ` Michael Haggerty
2015-04-30 18:03 ` David Turner
2015-04-30 18:19 ` Junio C Hamano
2015-04-30 18:28 ` David Turner
2015-04-30 18:32 ` Jeff King
2015-04-30 18:44 ` David Turner
2015-04-30 18:49 ` Jeff King
2015-04-30 19:00 ` David Turner
2015-04-30 19:10 ` Jeff King
2015-04-30 19:17 ` David Turner
2015-04-30 10:04 ` Andreas Schwab
2015-04-30 18:27 ` Jeff King
2015-04-30 19:18 ` Junio C Hamano
2015-04-30 19:25 ` David Turner
2015-04-30 19:46 ` Junio C Hamano
2015-04-30 19:51 ` Jeff King
2015-04-30 20:05 ` Junio C Hamano
2015-05-01 3:29 ` David Turner
2015-05-01 5:36 ` Jeff King
2015-05-01 17:29 ` David Turner
2015-05-01 20:11 ` Jeff King
2015-05-01 21:09 ` David Turner
2015-04-29 21:49 ` Junio C Hamano
2015-04-29 22:47 ` David Turner
2015-04-30 8:10 ` Michael Haggerty
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=xmqq7fsu4d1x.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).