summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-10-14 20:05:39 +0200
committerwm4 <wm4@nowhere>2013-10-14 20:14:17 +0200
commit5a1b60c5673bdd4861df7dfa0b8b10094b090d78 (patch)
treea561a07441cd8429e275490d8d8f4d3314c524b9
parent0f1764195a8b818ecafed37841e4c48d9f4718da (diff)
downloadmpv-5a1b60c5673bdd4861df7dfa0b8b10094b090d78.tar.bz2
mpv-5a1b60c5673bdd4861df7dfa0b8b10094b090d78.tar.xz
version.sh: don't use git tags for version output (again)
With the way I've been doing releases in the release/0.1 branch, this proved completely useless. You need to write the VERSION file anyway, and since we use github's automatically generated tarballs (via its release system), the VERSION file needs to be in the git revision of a release anyway. git master on the other hand displayed the v0.1.0 tag, because the tag is within the master branch. This essentially reverts commit b27f65a. Now just print the contents of the VERSION file if it exists, and likewise, we append the git revision if it exists. (Do that even if VERSION exists, because this way we can tell if someone is using the release branch at an in-between point where no new release has been made yet.)
-rwxr-xr-xversion.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/version.sh b/version.sh
index b905470139..bd8ca48741 100755
--- a/version.sh
+++ b/version.sh
@@ -21,13 +21,18 @@ done
# Extract revision number from file used by daily tarball snapshots
# or from "git describe" output
git_revision=$(cat snapshot_version 2> /dev/null)
-test $git_revision || test ! -e .git || git_revision=`git describe --match "v[0-9]*" --always --tags --long`
-git_revision=$(expr "$git_revision" : v*'\(.*\)')
-test $git_revision || git_revision=UNKNOWN
+test $git_revision || test ! -e .git || git_revision=`git rev-parse --short HEAD`
+test $git_revision && git_revision=git-$git_revision
+version="$git_revision"
# releases extract the version number from the VERSION file
-version=$(cat VERSION 2> /dev/null)
-test $version || version=$git_revision
+releaseversion=$(cat VERSION 2> /dev/null)
+if test $releaseversion ; then
+ test $version && version="-$version"
+ version="$releaseversion$version"
+fi
+
+test $version || version=UNKNOWN
VERSION="${version}${extra}"