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

Re: Bug report about symlinks

From
Duy Nguyen <pclouds@gmail.com>
Date
Aug 4, 2014, 11:03 UTC
Message-ID
<CACsJy8AKa2NBJT6+w87JqDM9eL5nw=3OjMCj-kq=yoyE6Oi_Ew@mail.gmail.com>
In-Reply-To
<xmqqk36ptrs6.fsf@gitster.dls.corp.google.com>
On Mon, Aug 4, 2014 at 12:19 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> I think you, who dug to find out where to add the check, already
> know this, and I am writing this mainly for myself and for the list
> archive, but when the knee-jerk "has-syjmlink-leading-path missing?"
> reaction came to me, two obvious optimizations also came to my mind:
>
>  - When checking a cache entry "a/b/c/d/e" and we find out "a/b/c"
>    is a symbolic link, we mark it as ~CE_VALID, but at the same
>    time, we learn "a/b/c/any/thing" are also ~CE_VALID with that
>    check, so we _could_, after the has_symlink_leading_path once
>    returns true, so there may be an opportunity to fast-forward the
>    scan, marking all paths under "a/b/c" as ~CE_VALID.
>
>  - After finding out "a/b/c" is a symbolic link to cause anything
>    underneath marked as ~CE_VALID, we also know "a/" and "a/b/"
>    exists as real directories, so a later check for "a/b/some/thing"
>    can start checking at "a/b/some/" without checking "a/" and "a/b/".

Just checking, you meant CE_UPTODATE, not CE_VALID, right? CE_VALID is only used with --assume-unchanged

Show 7 quoted lines
> The latter is more important as it is a much more common case that
> the shape of the working tree not to change.
>
> But I think the implementation of has_symlink_leading_path() already
> has these optimizations built inside around the (unfortunately named)
> "struct cache_def", so it probably would not give us much boost to
> implement such a fast-forwarding of the scan.

Yeah my first thought is another flood of lstat(). But it looks like has_symlink_leading_path() tries hard to reduce lstat() already. We could disable this call in filesytems that do not support symlinks (e.g. vfat) but I guess that's just a minority.

-- 
Duy
Previous: René ScharfeNext: Junio C Hamano
Message 9 of 10 in “Bug report about symlinks”
  1. Nikolay AvdeevJul 31, 2014
  2. René ScharfeJul 31, 2014
  3. Junio C HamanoAug 1, 2014
  4. René ScharfeAug 2, 2014
  5. Junio C HamanoAug 3, 2014
  6. René ScharfeAug 3, 2014
  7. Junio C HamanoAug 4, 2014
  8. read-cache: check for leading symlinks when refreshing indexRené Scharfe, Aug 9, 2014
  9. Duy NguyenAug 4, 2014
  10. Junio C HamanoAug 4, 2014

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.