aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-23 01:40:33 -0700
committerJunio C Hamano <gitster@pobox.com>2009-05-23 01:40:33 -0700
commit3ed24211d48d9a297b3784347acbf7e0265a58f3 (patch)
tree9f17d3a6437704ae543655d8a84d2ec064f02a1a
parent5781e80ffd4cd0c52cdfbf85cac3bb299544a2fc (diff)
parent53996fe5397ff37c5934bb5e9b23ef5985b3d152 (diff)
downloadgit-3ed24211d48d9a297b3784347acbf7e0265a58f3.tar.gz
git-3ed24211d48d9a297b3784347acbf7e0265a58f3.tar.xz
Merge branch 'lt/maint-diff-reduce-lstat'
* lt/maint-diff-reduce-lstat: Teach 'git checkout' to preload the index contents Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
-rw-r--r--builtin-checkout.c4
-rw-r--r--diff-lib.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c
index f2d7ef01b..b8a4b0139 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -216,7 +216,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
newfd = hold_locked_index(lock_file, 1);
- if (read_cache() < 0)
+ if (read_cache_preload(pathspec) < 0)
return error("corrupt index file");
if (source_tree)
@@ -366,7 +366,7 @@ static int merge_working_tree(struct checkout_opts *opts,
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
int newfd = hold_locked_index(lock_file, 1);
- if (read_cache() < 0)
+ if (read_cache_preload(NULL) < 0)
return error("corrupt index file");
if (opts->force) {
diff --git a/diff-lib.c b/diff-lib.c
index a310fb2ad..0aba6cda3 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -214,7 +214,7 @@ static int get_stat_data(struct cache_entry *ce,
const unsigned char *sha1 = ce->sha1;
unsigned int mode = ce->ce_mode;
- if (!cached) {
+ if (!cached && !ce_uptodate(ce)) {
int changed;
struct stat st;
changed = check_removed(ce, &st);