build.bash: handle missing git tags

The case of a git repo without any tags used to fail
with:

  fatal: No names found, cannot describe anything.

Now we continue, using "[no_tags_found]" as the
version string.
This commit is contained in:
Jakob Unterwurzacher 2020-04-18 17:44:51 +02:00
parent 5da5e9fdf2
commit 1c169ac55e

View File

@ -24,7 +24,7 @@ GOPATH1=$(go env GOPATH | cut -f1 -d:)
# gocryptfs version according to git or a VERSION file
if [[ -d .git ]] ; then
GITVERSION=$(git describe --tags --dirty)
GITVERSION=$(git describe --tags --dirty || echo "[no_tags_found]")
GITBRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ -n $GITBRANCH && $GITBRANCH != master ]] ; then
GITVERSION="$GITVERSION.$GITBRANCH"