Add tmp dir cleanup code to hasGitRepo test cases, reduce spurious failures

When the root temporary directory has a .git directory (like
/tmp/.git), it causes the hasGitRepo() method to correctly report that
any subdirectory of that root has a .git directory.  That was not the
condition that was intended to be tested.