Re: [PATCH 3/3] Avoid doing extra 'lstat()'s for d_type if we have an up-to-date cache entry
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 9, 2009, 18:37 UTC
- Message-ID
- <7vab3d3dpc.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <alpine.LFD.2.01.0907091013540.3352@localhost.localdomain>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 18 quoted lines
> We don't really verify the whole path when we mark things ce_uptodate(). > Part of what read_directory() does is to find directory entries, and in > the process things like "git add" will notice if there's a conflict with > existing index entries. > > So if a directory has changed into a symlink to a directory, this > particular optimization will actually hide that, I suspect. I haven't > tested, though. But it might be worth-while to see what happens when you > had a directory structure, and then do > > mkdir dir > touch dir/a > touch dir/b > git add dir > > mv dir new-dir > ln -s new-dir dir > git status
In existing codepaths, we have "has_symlink_leading_path()" checks to notice that tracked dir/[ab] have disappeared. "git diff" before or after "git status" in the above sequence does notice what you did.
Would dir/a be marked as uptodate in the index, if somebody preloads the index, after the above sequence? I hope not.