Skip to content
Permalink
Browse files

Merge pull request #2224: unpack-trees: enable fscache for sparse-che…

…ckout

When updating the skip-worktree bits in the index to align with new
values in a sparse-checkout file, Git scans the entire working
directory with lstat() calls. In a sparse-checkout, many of these
lstat() calls are for paths that do not exist.

Enable the fscache feature during this scan.

In a local test of a repo with ~2.2 million paths, updating the index
with `git read-tree -m -u HEAD` with a sparse-checkout file containing
only `/.gitattributes` improved from 2-3 minutes to 15-20 seconds.

More work could be done to stop running lstat() calls when recursing
into directories that are known to not exist.
  • Loading branch information...
derrickstolee committed Jun 18, 2019
2 parents d003d72 + f392fab commit e21386722b8bad309319f827420d77007f5ca242
Showing with 2 additions and 0 deletions.
  1. +2 −0 unpack-trees.c
@@ -1437,7 +1437,9 @@ static void mark_new_skip_worktree(struct exclude_list *el,
* 2. Widen worktree according to sparse-checkout file.
* Matched entries will have skip_wt_flag cleared (i.e. "in")
*/
enable_fscache(istate->cache_nr);
clear_ce_flags(istate, select_flag, skip_wt_flag, el);
disable_fscache();
}

static int verify_absent(const struct cache_entry *,

0 comments on commit e213867

Please sign in to comment.
You can’t perform that action at this time.