git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: David Turner <dturner@twopensource.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git mailing list <git@vger.kernel.org>
Subject: Re: RFC: git cat-file --follow-symlinks?
Date: Wed, 29 Apr 2015 21:16:12 -0400	[thread overview]
Message-ID: <20150430011612.GA7530@peff.net> (raw)
In-Reply-To: <1430355983.14907.55.camel@ubuntu>

On Wed, Apr 29, 2015 at 06:06:23PM -0700, David Turner wrote:

> >   HEAD^{resolve}:foo/bar
> [...]
>
> Just to clarify: if you do git rev-parse, and the result is an
> out-of-tree symlink, you see /foo or ../foo instead of a sha?  And if
> you "git show" it it says "symlink HEAD:../foo"?

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).

-Peff

  reply	other threads:[~2015-04-30  1:16 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 [this message]
2015-04-30  1:31                 ` Junio C Hamano
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=20150430011612.GA7530@peff.net \
    --to=peff@peff.net \
    --cc=dturner@twopensource.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).