cmake: Just check whether .git exists

When the source tree is a git submodule (for example when it is in
hawaii.git) ".git" is a file not a directory so we just check whether it
exists or not.