gvfs: ensure that the version is based on a GVFS tag

Since we really want to be based on a `.vfs.*` tag, let's make sure that
there was a new-enough one, i.e. one that agrees with the first three
version numbers of the recorded default version.

This prevents e.g. v2.22.0.vfs.0.<some-huge-number>.<commit> from being
used when the current release train was not yet tagged.

It is important to get the first three numbers of the version right
because e.g. Scalar makes decisions depending on those (such as assuming
that the `git maintenance` built-in is not available, even though it
actually _is_ available).

Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
This commit is contained in:
Johannes Schindelin 2017-04-04 12:04:11 +02:00 коммит произвёл Victoria Dye
Родитель 522afbd610
Коммит 5f594f4356
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -12,10 +12,15 @@ if test -f version
then
VN=$(cat version) || VN="$DEF_VER"
elif test -d ${GIT_DIR:-.git} -o -f .git &&
VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
VN=$(git describe --match "v[0-9]*vfs*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
if test "${VN%%.vfs.*}" != "${DEF_VER%%.vfs.*}"
then
echo "Found version $VN, which is not based on $DEF_VER" >&2
exit 1
fi
git update-index -q --refresh
test -z "$(git diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;