Fix extraneous lstat's in 'git checkout -f'
[gitweb.git] / 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))