From 6be691ac666fbfd2a712aff9fed5a80c619aae1d Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Sat, 4 Sep 2021 07:16:21 +0000 Subject: [PATCH] tools: Fix substring matching in bump script --- tools/namecoin-bump-versions.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/namecoin-bump-versions.sh b/tools/namecoin-bump-versions.sh index 593f702..3c4b439 100755 --- a/tools/namecoin-bump-versions.sh +++ b/tools/namecoin-bump-versions.sh @@ -74,7 +74,11 @@ do LATEST_INFO=$(git ls-remote "${GIT_URL}" HEAD ${LATEST_TAG} ${LATEST_TAG}^{}) PROJECT_UPDATE_NEEDED=0 - echo "${LATEST_INFO}" | grep ${GIT_REV} > /dev/null || PROJECT_UPDATE_NEEDED=1 + # Search for the Git rev, either as a tag between a slash and the end of a + # line, a tag between a slash and ^{}, or a hash between the start of a + # line and whitespace. Prevent substring matches e.g. matching v0.2.2 when + # searching for v0.2. + echo "${LATEST_INFO}" | grep -E '(^|\/)'${GIT_REV}'((\^\{\})?$|\s)' > /dev/null || PROJECT_UPDATE_NEEDED=1 if [ "${PROJECT_UPDATE_NEEDED}" = 1 ] then UPDATE_NEEDED=1