]> asedeno.scripts.mit.edu Git - git.git/commitdiff
verify_uptodate(): add ce_uptodate(ce) test
authorKjetil Barvik <barvik@broadpark.no>
Thu, 19 Feb 2009 20:08:30 +0000 (21:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Feb 2009 05:39:51 +0000 (21:39 -0800)
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 eadb5831342bb2e756fa05c03642c4aa1929d4f5
    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>
unpack-trees.c

index 11902cd51da9d83952df03edc1aadffc41e3f05b..9fe0cd5f9b4e39dc8685a29c293a6138c02dcf4f 100644 (file)
@@ -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)) {