Fix git detection with .git files

These are used for submodules for example.