From 96783f7d0649dddbb500245dcb9c86e409e122ca Mon Sep 17 00:00:00 2001 From: Michael Harp Date: Thu, 3 Sep 2026 10:40:57 -0400 Subject: [PATCH] Survive the openvox repo's broken nested tags when picking a release The git gem 5.x bump (#472) broke every reference build that resolves the newest release tag itself (any `rake references:*` without an explicit VERSION). Git::Base#tags re-resolves each tag name and, since 5.x, raises on the literal `tags/2.6.0rc1..3` tags that exist in the upstream openvox repository: Git::UnexpectedResultError: Tag 'tags/tags/2.6.0rc1' does not exist. The gem offers no non-raising listing (Git::Base#lib is deprecated and delegates back to the same path), so list tag names with a plain `git tag --list` and parse those; names that are not versions are discarded, which also replaces the old trick of mapping them to version 0. Co-Authored-By: Claude Fable 5 Signed-off-by: Michael Harp --- lib/puppet_references/repo.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/puppet_references/repo.rb b/lib/puppet_references/repo.rb index 2612dc278..1694454cc 100644 --- a/lib/puppet_references/repo.rb +++ b/lib/puppet_references/repo.rb @@ -46,9 +46,20 @@ def tags end def newest_release - @repo.tags.map { |t| Gem::Version.new(t.name) rescue Gem::Version.new(0) } # rubocop:disable Style/RescueModifier - .reject(&:prerelease?) - .max.version # rubocop:disable Layout/MultilineMethodCallIndentation + versions = tag_names.filter_map { |name| Gem::Version.new(name) rescue nil } # rubocop:disable Style/RescueModifier + .reject(&:prerelease?) + raise "#{@name}: no stable release tag found" if versions.empty? + + versions.max.version + end + + # Tag names straight from `git tag --list`. The git gem's tag enumeration + # (Git::Base#tags) re-resolves every name and, since git 5.x, raises on the + # literal `tags/2.6.0rc*` tags that exist in the openvox repository, so + # list the names without validating them; non-version names are discarded + # by the caller anyway. + def tag_names + Dir.chdir(@directory) { `git tag --list`.split("\n") } end def update_bundle