Cache the fact that a file is known to git.

This allows us to avoid checking whether a file known to git is known to
git every time we run a diff.