Skip to content

Commit

Permalink
verify_uptodate(): add ce_uptodate(ce) test
Browse files Browse the repository at this point in the history
If we inside verify_uptodate() can already tell from the ce entry that
it is already uptodate by testing it with ce_uptodate(ce), there is no
need to call lstat(2) and ie_match_stat() afterwards.

And, reading from the commit log message from:

    commit eadb583
    Author: Junio C Hamano <gitster@pobox.com>
    Date:   Fri Jan 18 23:45:24 2008 -0800

    Avoid running lstat(2) on the same cache entry.

this also seems to be correct usage of the ce_uptodate() macro
introduced by that patch.

This will avoid lots of lstat(2) calls in some cases, for example
by running the 'git checkout' command.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Kjetil Barvik authored and Junio C Hamano committed Feb 20, 2009
1 parent fba2f38 commit 1dcafcc
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 @@ -430,7 +430,7 @@ static int verify_uptodate(struct cache_entry *ce,
{
struct stat st;

if (o->index_only || o->reset)
if (o->index_only || o->reset || ce_uptodate(ce))
return 0;

if (!lstat(ce->name, &st)) {
Expand Down

0 comments on commit 1dcafcc

Please sign in to comment.