From: Linus Torvalds Date: Tue, 14 Jul 2009 21:19:10 +0000 (-0700) Subject: Fix extraneous lstat's in 'git checkout -f' X-Git-Tag: v1.6.4-rc1~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=05c1da2f5e7a5c0d2bbd1154bbb6c5cc9cb2b17f;p=git.git Fix extraneous lstat's in 'git checkout -f' 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 Signed-off-by: Junio C Hamano --- diff --git a/unpack-trees.c b/unpack-trees.c index f9d12aafb..48d862d3b 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -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))