mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-17 07:21:10 -05:00
This is a companion of https://github.com/microsoft/git/pull/899. Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add. Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.