Fix file cache flush deleting .gitignore files. Fixes #1071.