Skip to content

Commit 3a2f662

Browse files
derrickstoleeGit for Windows Build Agent
authored andcommitted
Merge branch 'unpack-trees-fscache'
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. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 4f60a71 + 5aacd8e commit 3a2f662

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

unpack-trees.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,9 @@ static void mark_new_skip_worktree(struct exclude_list *el,
14411441
* 2. Widen worktree according to sparse-checkout file.
14421442
* Matched entries will have skip_wt_flag cleared (i.e. "in")
14431443
*/
1444+
enable_fscache(istate->cache_nr);
14441445
clear_ce_flags(istate, select_flag, skip_wt_flag, el);
1446+
disable_fscache();
14451447
}
14461448

14471449
static int verify_absent(const struct cache_entry *,

0 commit comments

Comments
 (0)