Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/base/get_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,10 @@ cd "$(dirname ${BASH_SOURCE[0]})"
# Read the partial version number specified in the first line of src/.version.
version=$(head -1 ../.version)

# Empty version number is not allowed.
if [ -z "$version" ]; then
version="?"
fi

if [ -e ../.short_version ]; then
echo "$0: File src/.short_version exists."
echo "$0: Stopping the construction of full version number from git history."
elif [[ $version != +([0-9]).+([0-9]) ]]; then
elif ! [[ $version =~ ^[0-9][0-9]*.[0-9][0-9]*$ ]]; then
echo "$0: The version number \"$version\" specified in src/.version is not" \
"in MAJOR.MINOR format."
echo "$0: Stopping the construction of full version number from git history."
Expand Down Expand Up @@ -76,6 +71,11 @@ else
version="$version-${head_commit_short}"
fi

# Empty version number is not allowed.
if [ -z "$version" ]; then
version="?"
fi

# Write version info to a temporary file.
temp=$(mktemp)
trap 'rm -f "$temp"' EXIT
Expand Down