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

Re: [PATCH v5 3/3] cat-file: add --follow-symlinks to --batch

From
David Turner <dturner@twopensource.com>
Date
May 12, 2015, 21:37 UTC
Message-ID
<1431466646.16652.32.camel@ubuntu>
In-Reply-To
<xmqqh9rhftlh.fsf@gitster.dls.corp.google.com>
On Tue, 2015-05-12 at 13:07 -0700, Junio C Hamano wrote:
Show 29 quoted lines
> 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. Or maybe sub/link was actually a link to ../outlink, and ../outlink was a link to ../nextlink.

But I think I'm OK with implementing your proposed solution[1] of categorizing all of the possible cases.

[1] http://www.spinics.net/lists/git/msg250893.html xmqqd225fsw8.fsf@gitster.dls.corp.google.com

Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 20 in “cat-file --follow-symlinks”
  1. 0/3 cat-file --follow-symlinksdturner@twopensource.com, May 11, 2015
  2. 1/3 tree-walk: learn get_tree_entry_follow_symlinksdturner@twopensource.com, May 11, 2015
  3. Johannes SixtMay 12, 2015
  4. 2/3 sha1_name: get_sha1_with_context learns to follow symlinksdturner@twopensource.com, May 11, 2015
  5. 3/3 cat-file: add --follow-symlinks to --batchdturner@twopensource.com, May 11, 2015
  6. Johannes SixtMay 12, 2015
  7. Junio C HamanoMay 12, 2015
  8. David TurnerMay 12, 2015
  9. Junio C HamanoMay 12, 2015
  10. David TurnerMay 12, 2015
  11. Junio C HamanoMay 12, 2015
  12. Junio C HamanoMay 12, 2015
  13. David TurnerMay 12, 2015
  14. Junio C HamanoMay 12, 2015
  15. Junio C HamanoMay 12, 2015
  16. Junio C HamanoMay 12, 2015
  17. David TurnerMay 12, 2015
  18. Junio C HamanoMay 12, 2015
  19. David TurnerMay 12, 2015
  20. Junio C HamanoMay 14, 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.