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

Re: RFC: git cat-file --follow-symlinks?

From
David Turner <dturner@twopensource.com>
Date
Apr 30, 2015, 01:06 UTC
Message-ID
<1430355983.14907.55.camel@ubuntu>
In-Reply-To
<20150430003750.GA4258@peff.net>
On Wed, 2015-04-29 at 20:37 -0400, Jeff King wrote:
Show 43 quoted lines
> On Wed, Apr 29, 2015 at 07:11:50PM -0400, Jeff King wrote:
> 
> > Yeah, I agree if you let git punt on leaving the filesystem, most of the
> > complicated problems go away. It still feels a bit more magical than I
> > expect out of cat-file, and there are still corner cases (e.g., do we do
> > cycle detection? Or just have a limit to the recursion depth?)
> 
> I was pondering the "magical" above. I think what bugs me is that it
> seems like a feature that is implemented as part of one random bit of
> plumbing, but not available elsewhere.
> 
> Conceptually, this is like peeling object names. You may give a tag
> name, but if you ask for a tree commit we will peel the tag to a commit,
> and the commit to a tree. This is sort of the same thing; you give a
> path within a tree, and we will peel until we hit a "real" non-symlink
> object.
> 
> I don't know what the syntax would look like. To match "foo^{tree}" it
> would be something like:
> 
>   HEAD:foo/bar^{resolve}
> 
> or something like that. Except that it is a bad idea to allow "^{}"
> syntax on the right-hand side of a colon, as it is ambiguous with
> filenames that contain "^{resolve}". So it would have to look something
> like:
> 
>   HEAD^{resolve}:foo/bar
> 
> which is a _little_ weird, but actually kind of makes sense. The
> "resolve" operation inherently is not just about the filename, but about
> uses HEAD^{tree} as the root context.
> 
> So I dunno. This pushes the resolving logic even _lower_ in the stack
> than it would be in cat-file. So why do I like it more? Cognitive
> dissonance? I guess I the appeal to me is that it:
> 
>   1. Makes the concept available more generally (you can "rev-parse" it,
>      you can "git show" it, etc). It also lets you _name_ the object in
>      question, so you can ask for other things besides it contents (like
>      its name, its type, etc).
> 
>   2. Positions it alongside other peeling name-resolution functions.

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"?

This seems totally reasonable to me, and solves my problem.
Previous: Jeff KingNext: Jeff King
Message 12 of 43 in “RFC: git cat-file --follow-symlinks?”
  1. David TurnerApr 29, 2015
  2. Jonathan NiederApr 29, 2015
  3. David TurnerApr 29, 2015
  4. Junio C HamanoApr 29, 2015
  5. David TurnerApr 29, 2015
  6. Jeff KingApr 29, 2015
  7. Jonathan NiederApr 29, 2015
  8. Jeff KingApr 29, 2015
  9. David TurnerApr 29, 2015
  10. Jeff KingApr 29, 2015
  11. Jeff KingApr 30, 2015
  12. David TurnerApr 30, 2015
  13. Jeff KingApr 30, 2015
  14. Junio C HamanoApr 30, 2015
  15. Jeff KingApr 30, 2015
  16. David TurnerApr 30, 2015
  17. Jeff KingApr 30, 2015
  18. Junio C HamanoApr 30, 2015
  19. Michael HaggertyApr 30, 2015
  20. David TurnerApr 30, 2015
  21. Junio C HamanoApr 30, 2015
  22. David TurnerApr 30, 2015
  23. Jeff KingApr 30, 2015
  24. David TurnerApr 30, 2015
  25. Jeff KingApr 30, 2015
  26. David TurnerApr 30, 2015
  27. Jeff KingApr 30, 2015
  28. David TurnerApr 30, 2015
  29. Andreas SchwabApr 30, 2015
  30. Jeff KingApr 30, 2015
  31. Junio C HamanoApr 30, 2015
  32. David TurnerApr 30, 2015
  33. Junio C HamanoApr 30, 2015
  34. Jeff KingApr 30, 2015
  35. Junio C HamanoApr 30, 2015
  36. David TurnerMay 1, 2015
  37. Jeff KingMay 1, 2015
  38. David TurnerMay 1, 2015
  39. Jeff KingMay 1, 2015
  40. David TurnerMay 1, 2015
  41. Junio C HamanoApr 29, 2015
  42. David TurnerApr 29, 2015
  43. Michael HaggertyApr 30, 2015

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.