When git/hg is present, use them to list the files.

This is useful so we don't search on gitignored files.