]> git.ipfire.org Git - thirdparty/git.git/commit
unpack-trees: skip stat on fsmonitor-valid files
authorUtsav Shah <utsav@dropbox.com>
Wed, 20 Nov 2019 08:32:17 +0000 (08:32 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Nov 2019 03:48:18 +0000 (12:48 +0900)
commit679f2f9fdd2173d87251aee357dd0e46ce977f42
treeaba26ef4deb496411e0deda85828b5ff3a3f39bd
parent61eea521fef11c6878a4157bcc0fca6e981a58b2
unpack-trees: skip stat on fsmonitor-valid files

The index might be aware that a file hasn't modified via fsmonitor, but
unpack-trees did not pay attention to it and checked via ie_match_stat
which can be inefficient on certain filesystems. This significantly slows
down commands that run oneway_merge, like checkout and reset --hard.

This patch makes oneway_merge check whether a file is considered
unchanged through fsmonitor and skips ie_match_stat on it. unpack-trees
also now correctly copies over fsmonitor validity state from the source
index. Finally, for correctness, we force a refresh of fsmonitor state in
tweak_fsmonitor.

After this change, commands like stash (that use reset --hard
internally) go from 8s or more to ~2s on a 250k file repository on a
mac.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
Signed-off-by: Utsav Shah <utsav@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsmonitor.c
t/t7519-status-fsmonitor.sh
unpack-trees.c