aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-03-15 11:11:45 +0100
committerFlorian Dold <florian@dold.me>2023-03-15 11:12:00 +0100
commit1677379a3c3608374b9a8e70ff12afdfa63b4c76 (patch)
tree96232e402cef33a785aed7294ecc9445165f0c3d
parentba1003b9f9109ca7223165542eedb8c7b5c4ef38 (diff)
downloadgnunet-1677379a3c3608374b9a8e70ff12afdfa63b4c76.tar.gz
gnunet-1677379a3c3608374b9a8e70ff12afdfa63b4c76.zip
make version info robust w.r.t. sparse git checkouts
-rwxr-xr-xcontrib/get_version.sh18
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
3VERSION= 3VERSION=
4if test -f ".version" 4if test -f ".version"; then
5then
6 VERSION=$(cat .version) 5 VERSION=$(cat .version)
7fi 6fi
8if [ -e ./.git ] 7if [ -e ./.git ]; then
9then 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
13fi 14fi
14if test "x$VERSION" = "x" 15if test "x$VERSION" = "x"; then
15then
16 VERSION="unknown" 16 VERSION="unknown"
17fi 17fi
18case $1 in 18case $1 in