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

Re: Troubles when directory is replaced by symlink

From
KBKjetil Barvik <barvik@broadpark.no>
Date
Jun 11, 2009, 14:37 UTC
Message-ID
<86ab4erg3m.fsf@broadpark.no>
In-Reply-To
<20090611114846.GC4409@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 51 quoted lines
> [Kjetil: I bisected this bug to your 92604b4. Details below.]
>
> On Tue, Jun 09, 2009 at 12:18:16PM +0400, Alexander Gladysh wrote:
>
>> Any help here? This bug is pretty annoying (especially that it
>> requires double hard resets).
>> 
>> Should I provide any extra information?
>
> Actually, I think the problem happens earlier than you realize; I see
> problems when switching back to master:
>
> -- >8 --
> # make a repo
> mkdir repo && cd repo && git init
>
> # content in alpha
> mkdir alpha && echo content >alpha/file && git add . && git commit -m one
> # and duplicate content inside beta
> mkdir beta && cp -R alpha beta && git add . && git commit -m two
>
> # now replace the duplicate with a symlink
> git checkout -b branch
> rm -rf beta/alpha && git add -u && git commit -m deleted
> ln -s ../alpha beta/alpha && git add . && git commit -m symlink
>
> # now checkout master again; alpha/file will be missing, even
> # though it wasn't touched at all
> git checkout master
> git status
> -- 8< --
>
> We handled this correctly in v1.6.1, so I was able to bisect it down to:
>
>     commit 92604b466344b2157efc42ef3521dac22d7906a2
>     Author: Kjetil Barvik <barvik@broadpark.no>
>     Date:   Sun Jan 18 16:14:50 2009 +0100
>
>         lstat_cache(): more cache effective symlink/directory detection
>
>         Make the cache functionality more effective.  Previously when
>         A/B/C/D was in the cache and A/B/C/E/file.c was called for,
>         there was no match at all from the cache.  Now we use the fact
>         that the paths "A", "A/B" and "A/B/C" are already tested, and we
>         only need to do an lstat() call on "A/B/C/E".
>
> I don't have time to look more closely now, but I'm guessing we are
> treating the symlink to the directory like the directory itself in a
> place that we shouldn't.
>
> -Peff
  OK, I start debuging in a few minutes.  Thanks for mail!
  -- kjetil
Previous: Jeff KingNext: Kjetil Barvik
Message 4 of 9 in “Troubles when directory is replaced by symlink”
  1. Alexander GladyshJun 5, 2009
  2. Alexander GladyshJun 9, 2009
  3. Jeff KingJun 11, 2009
  4. Kjetil BarvikJun 11, 2009
  5. Kjetil BarvikJun 14, 2009
  6. James PickensJun 24, 2009
  7. Kjetil BarvikJun 25, 2009
  8. Kjetil BarvikJun 26, 2009
  9. Johannes SixtJun 26, 2009

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.