From 6f416b20c3cbbb829e8fe76951e45e2b64a54bf2 Mon Sep 17 00:00:00 2001 From: Tjaart van der Walt Date: Mon, 7 May 2018 14:44:35 -0700 Subject: [PATCH] Fix greedy match of version number The original regex will greedily match the first digit of version numbers that have multiple digits. --- bin/git-release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-release b/bin/git-release index 18fda98..ae47e9f 100755 --- a/bin/git-release +++ b/bin/git-release @@ -58,7 +58,7 @@ if test $# -gt 0; then latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)") if [[ ! "$latest_tag" =~ \ - ^([^0-9]*)([0-9]|[1-9][0-9]+)\.([0-9]|[1-9][0-9]+)\.([0-9]|[1-9][0-9]+)(.*) ]]; then + ^([^0-9]*)([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])(.*) ]]; then echo "the latest tag doesn't match semver format requirement" 1>&2 exit 1 fi