diff options
-rwxr-xr-x | contrib/get_version.sh | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/get_version.sh b/contrib/get_version.sh index 6e3ab5141..00f418f3c 100755 --- a/contrib/get_version.sh +++ b/contrib/get_version.sh | |||
@@ -1,18 +1,18 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # Gets the version number from git, or from the contents of .version | 2 | # Gets the version number from git, or from the contents of .version |
3 | VERSION= | 3 | VERSION= |
4 | if test -f ".version" | 4 | if test -f ".version"; then |
5 | then | ||
6 | VERSION=$(cat .version) | 5 | VERSION=$(cat .version) |
7 | fi | 6 | fi |
8 | if [ -e ./.git ] | 7 | if [ -e ./.git ]; then |
9 | then | 8 | # With sparse checkouts, we have a .git dir but possibly no tags |
10 | VERSION=$(git describe --tags) | 9 | gitver=$(git describe --tags 2>/dev/null || echo no-git-version) |
11 | VERSION=${VERSION#v} | 10 | if test "$gitver" != "no-git-version"; then |
12 | echo $VERSION > .version | 11 | VERSION=${gitver#v} |
12 | echo "$VERSION" > .version | ||
13 | fi | ||
13 | fi | 14 | fi |
14 | if test "x$VERSION" = "x" | 15 | if test "x$VERSION" = "x"; then |
15 | then | ||
16 | VERSION="unknown" | 16 | VERSION="unknown" |
17 | fi | 17 | fi |
18 | case $1 in | 18 | case $1 in |