Improve IsGitRepository check by using git.exe to do it

Fixes #520