Skip to content

Commit

Permalink
Merge branch 'lt/maint-diff-reduce-lstat'
Browse files Browse the repository at this point in the history
* lt/maint-diff-reduce-lstat:
  Teach 'git checkout' to preload the index contents
  Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
  • Loading branch information
gitster committed May 23, 2009
2 parents 5781e80 + 53996fe commit 3ed2421
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions builtin-checkout.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion diff-lib.c
Expand Up @@ -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);
Expand Down

0 comments on commit 3ed2421

Please sign in to comment.