]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Fix extraneous lstat's in 'git checkout -f'
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Jul 2009 21:19:10 +0000 (14:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Jul 2009 22:17:01 +0000 (15:17 -0700)
In our 'oneway_merge()' we always do an 'lstat()' to see if we might
need to mark the entry for updating.

But we really shouldn't need to do that when the cache entry is already
marked as being ce_uptodate(), and this makes us do unnecessary lstat()
calls if we have index preloading enabled.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c

index f9d12aafba8255401cd4e6d749f8738eb6e0857e..48d862d3b478875c3747bdb39a8cba0068300e97 100644 (file)
@@ -1004,7 +1004,7 @@ int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o)
 
        if (old && same(old, a)) {
                int update = 0;
-               if (o->reset) {
+               if (o->reset && !ce_uptodate(old)) {
                        struct stat st;
                        if (lstat(old->name, &st) ||
                            ie_match_stat(o->src_index, old, &st, CE_MATCH_IGNORE_VALID))