Re: [PATCH 01/02/RFC] implement a stat cache
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Apr 21, 2008, 03:20 UTC
- Message-ID
- <alpine.LFD.1.10.0804202016080.2779@woody.linux-foundation.org>
- In-Reply-To
- <alpine.LFD.1.10.0804201959590.2779@woody.linux-foundation.org>
On Sun, 20 Apr 2008, Linus Torvalds wrote:
Show 10 quoted lines
> On Sun, 20 Apr 2008, Junio C Hamano wrote:
> >
> > If you have a tracked path a/b/c/d/e, and you changed your work tree to
> > make a/b to a symlink that points at a random directory, potentially
> > even outside work tree, that has c/d/e in it, we should not be fooled by
> > the fact that lstat("a/b/c/d/e") says "yup, the file exists". As far as
> > git is concerned, that path does _not_ exist, as "a/b" is a symlink now.
>
> Ok, I can see the logic behind that, but the code is really dense and hard
> to read. And obviously very inefficient.One more note: I think that if we really care about this, we should do this inside "ce_match_stat()", so that we catch it in *all* the cases where we match against the stat information.
As it is, the "diff" mechanism (and "apply") knows to check whether a directory has changed into a symlink, but it looks like doing a simple "git update-index --refresh" will never even test it, so it will never notice that the index isn't actually up-to-date if a directory has been moved and the old directory has been replaced by a symlink to the new location.
Hmm?
Linus