author | Junio C Hamano <gitster@pobox.com> | |
Sat, 23 May 2009 08:40:33 +0000 (01:40 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 23 May 2009 08:40:33 +0000 (01:40 -0700) |
* lt/maint-diff-reduce-lstat:
Teach 'git checkout' to preload the index contents
Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
Teach 'git checkout' to preload the index contents
Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
builtin-checkout.c | patch | blob | history | |
diff-lib.c | patch | blob | history |
diff --git a/builtin-checkout.c b/builtin-checkout.c
index f2d7ef01b0bbe667ae8042f7a806a634fa0aa46b..b8a4b0139b3b9c2f731315413a73db30edaf9231 100644 (file)
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
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)
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 a310fb2ad08cfb5fac01f5519e8b95b2338b07db..0aba6cda3c01e17b07bb7235b0395ba50256aedd 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
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);