From 68bf4fe26d500fb57d3b8e95517638d949ea6d90 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Thu, 19 Oct 2023 22:25:05 +1100 Subject: [PATCH 1/2] Remove duplicate code The functionality is included in `shared.sh` which is sourced by this file --- version-lookup.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/version-lookup.sh b/version-lookup.sh index 58c3fae..cb1d4d4 100755 --- a/version-lookup.sh +++ b/version-lookup.sh @@ -10,18 +10,6 @@ if [[ "${input_errors}" == 'true' ]] ; then exit 8 fi -##==---------------------------------------------------------------------------- -## MacOS compatibility - for local testing - -export grep="grep" -if [[ "$(uname)" == "Darwin" ]] ; then - export grep="ggrep" - if ! grep --version 1>/dev/null ; then - echo "🛑 GNU grep not installed, try brew install coreutils" 1>&2 - exit 9 - fi -fi - ##==---------------------------------------------------------------------------- ## Get tags from GitHub repo From bfdbc118ba3aab7fbe8dd7aef370484653fd3829 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Thu, 19 Oct 2023 22:26:03 +1100 Subject: [PATCH 2/2] Remove transitional code We don't have any more projects at `reecetech` that use the older non-semver compliant calver versioning --- tests/test_version-lookup.bats | 12 ------------ version-lookup.sh | 9 --------- 2 files changed, 21 deletions(-) diff --git a/tests/test_version-lookup.bats b/tests/test_version-lookup.bats index 1287999..b0864e8 100644 --- a/tests/test_version-lookup.bats +++ b/tests/test_version-lookup.bats @@ -110,18 +110,6 @@ function init_repo { [[ "$output" = *"CURRENT_VERSION=$(date '+%Y.%-m.0')"* ]] } -@test "converts from older calver scheme automatically" { - init_repo - - git tag 2020-09-R2 - - run ../../version-lookup.sh - - print_run_info - [ "$status" -eq 0 ] && - [[ "$output" = *"CURRENT_VERSION=2020.9.2"* ]] -} - @test "strips v from the version" { init_repo diff --git a/version-lookup.sh b/version-lookup.sh index cb1d4d4..130ca89 100755 --- a/version-lookup.sh +++ b/version-lookup.sh @@ -41,15 +41,6 @@ else )" fi -# support transition from an old reecetech calver style (yyyy-mm-Rr, where R is the literal `R`, and r is the nth release for the month) -if [[ -z "${current_version:-}" ]] ; then - current_version="$(git tag -l | { ${grep} -P "${pcre_old_calver}" || true; } | sort -V | tail -n 1)" - if [[ -n "${current_version:-}" ]] ; then - # convert - to . and drop leading zeros & the R - current_version="$(echo "${current_version}" | sed -r 's/^([0-9]+)-0{0,1}([0-9]+)-R0{0,1}([0-9]+)$/\1.\2.\3/')" - fi -fi - # handle no version detected - start versioning! if [[ -z "${current_version:-}" ]] ; then echo "⚠️ No previous release version identified in git tags"