version.sh: handle shallow clones and snapshots.