Skip to content

Commit

Permalink
Get the version even if no tag is present
Browse files Browse the repository at this point in the history
If not tag is present, git cannot describe the commit.
In this case we want "none" version.
  • Loading branch information
amadvance committed Jan 5, 2016
1 parent f277bf2 commit 51f064d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions autover.sh
Expand Up @@ -3,12 +3,17 @@

if [ -d .git ]; then
# Get version from git tags, removing the 'v' prefix
VERSION=`git describe --match 'v*' | sed 's/^v//'`
elif [ -f .version ]; then
VERSION=`git describe --match 'v*' 2>/dev/null | sed 's/^v//'`
fi

if [ -f .version ]; then
# Get version from the .version file
VERSION=`cat .version`
else
fi

if [ -z $VERSION ]; then
VERSION="none"
fi

printf '%s' "$VERSION"

0 comments on commit 51f064d

Please sign in to comment.