Fix for finding .git and .hg repositories