Skip to content

Commit

Permalink
Fix extraneous lstat's in 'git checkout -f'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Jul 14, 2009
1 parent a388373 commit 05c1da2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unpack-trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 05c1da2

Please sign in to comment.