Win32: add a cache below mingw's lstat and dirent implementations
commit2163e35dae94af092cf8644bb10a877cc1318892
authorKarsten Blees <blees@dcon.de>
Tue, 1 Oct 2013 10:51:54 +0000 (1 12:51 +0200)
committerStepan Kasal <kasal@ucw.cz>
Thu, 15 May 2014 07:43:40 +0000 (15 09:43 +0200)
tree78dec32eb0e23e67679c24253be73dd9f2ff886a
parentc554d49c5cad79922c38e88d51bb19cb56985dc5
Win32: add a cache below mingw's lstat and dirent implementations

Checking the work tree status is quite slow on Windows, due to slow lstat
emulation (git calls lstat once for each file in the index). Windows
operating system APIs seem to be much better at scanning the status
of entire directories than checking single files.

Add an lstat implementation that uses a cache for lstat data. Cache misses
read the entire parent directory and add it to the cache. Subsequent lstat
calls for the same directory are served directly from the cache.

Also implement opendir / readdir / closedir so that they create and use
directory listings in the cache.

The cache doesn't track file system changes and doesn't plug into any
modifying file APIs, so it has to be explicitly enabled for git functions
that don't modify the working copy.

Note: in an earlier version of this patch, the cache was always active and
tracked file system changes via ReadDirectoryChangesW. However, this was
much more complex and had negative impact on the performance of modifying
git commands such as 'git checkout'.

Signed-off-by: Karsten Blees <blees@dcon.de>
compat/win32/fscache.c [new file with mode: 0644]
compat/win32/fscache.h [new file with mode: 0644]
config.mak.uname
git-compat-util.h