version.sh: fix for when master branch does not exist

This can happen when the repo is cloned with --branch.
In this case, don't try to find the merge-base and don't
append it to the version string.