From 4a045894fe9f63942c0f8afebc00c3237ae1586a Mon Sep 17 00:00:00 2001 From: Konstantinos Pachnis Date: Wed, 20 Jun 2018 12:34:25 +0300 Subject: [PATCH] Update RegEx to support versioning of the form xxx.xxx.xxx --- git-release | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git-release b/git-release index 40481c6..04c5764 100644 --- a/git-release +++ b/git-release @@ -41,7 +41,7 @@ usage() { create_release_number() { checks - if echo "$version_no" | grep [0-9].[0-9].[0-9] >/dev/null; then + if echo "$version_no" | egrep "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" >/dev/null; then remotes="$(git remote)" git tag -s "$version_no" -m "Create version $version_no" @@ -97,7 +97,7 @@ auto_release_number() { local version="$(git tag -l | sort -n -r -t. -k1,1 -k2,2 -k3,3 | head -n 1)" - if echo "$version" | grep [0-9].[0-9].[0-9] >/dev/null; then + if echo "$version" | egrep "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" >/dev/null; then case $version_type in 'major') version_no="$(echo $version | awk -F . '{ print $1+1 "." 0 "." 0 }')" @@ -157,7 +157,7 @@ delete_release_number() { checks - if ! echo "$version_no" | grep [0-9].[0-9].[0-9] >/dev/null; then + if ! echo "$version_no" | egrep "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" >/dev/null; then printf "Release $version_no not found\n" exit $EPERM fi -- 2.45.2