Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### Fixed
- `bashunit upgrade` resolved the floating `v0` Action tag as the latest version, breaking upgrades; it now only considers exact-version tags

## [0.39.0](https://github.com/TypedDevs/bashunit/compare/0.38.0...0.39.0) - 2026-06-09

### Added
Expand Down
2 changes: 2 additions & 0 deletions src/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,12 @@ function bashunit::helper::get_latest_tag() {
return 1
fi

# Floating major tags (e.g. v0) are not releases and must not win
git ls-remote --tags "$BASHUNIT_GIT_REPO" |
awk '{print $2}' |
sed 's|^refs/tags/||' |
grep -v '\^{}' |
grep -E '^[0-9]+\.[0-9]+(\.[0-9]+)?$' |
sort -Vr |
head -n 1
}
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/helpers_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,17 @@ EOF
unset -f git # remove the mock
}

function test_get_latest_tag_ignores_floating_major_tags() {
bashunit::mock git <<EOF
fc9aac40eb8e5ad4483f08d79eb678a3650dcf78 refs/tags/0.38.0
3977be123b0b73cfdf4b4eff46b909f37aa83b3c refs/tags/0.39.0
9bb3726a1bf83fb09ca548a398762ab89baaa9b6 refs/tags/v0
b546c693198870dd75d1a102b94f4ddad6f4f3ea refs/tags/v0^{}
EOF
assert_same "0.39.0" "$(bashunit::helper::get_latest_tag)"
unset -f git # remove the mock
}

function test_to_run_with_filter_matching_string_in_function_name() {
local functions
functions=("test_my_awesome_function" "test_your_awesome_function" "test_so_lala_function")
Expand Down
Loading