isdir('.git') is never correct.