Skip to content

Commit

Permalink
Added a fallback for when no tag is present
Browse files Browse the repository at this point in the history
  • Loading branch information
robpc committed Feb 21, 2020
1 parent 23b5639 commit 592d2d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ BUILD_GIT_TAG_DISTANCE=`echo ${BUILD_GIT_TAG_LONG} | awk -F '-' '{print $2}'`

REGEX_VERSION='^(.*\/)?[0-9]+\.[0-9]+(\.[0-9]+)?$'

if [ "$BUILD_GIT_TAG_LONG" = "$BUILD_GIT_TAG" ]; then
if [ "$BUILD_GIT_TAG_LONG" = "" ]; then
# Without a tag, we can't get the distance from describe so making it up here with time and hash
export BUILD_VERSION=0.0.0-${BUILD_GIT_BRANCH_CLEAN}.t${BUILD_GIT_COMMIT_EPOCH}.g${BUILD_GIT_COMMIT_SHORT}
elif [ "$BUILD_GIT_TAG_LONG" = "$BUILD_GIT_TAG" ]; then
export BUILD_VERSION=${BUILD_GIT_TAG}
else
if [ -z "$BUILD_GIT_TAG_DISTANCE" ]; then
Expand Down

0 comments on commit 592d2d5

Please sign in to comment.