Fix detection of versions with git 1.8+, fixes #2065