summaryrefslogtreecommitdiff
path: root/app/finders/repositories/previous_tag_finder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/repositories/previous_tag_finder.rb')
-rw-r--r--app/finders/repositories/previous_tag_finder.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/finders/repositories/previous_tag_finder.rb b/app/finders/repositories/previous_tag_finder.rb
index 150a6332c29..b5e786c30e9 100644
--- a/app/finders/repositories/previous_tag_finder.rb
+++ b/app/finders/repositories/previous_tag_finder.rb
@@ -16,12 +16,13 @@ module Repositories
# This finder expects that all tags to consider meet the following
# requirements:
#
- # * They start with the letter "v"
- # * They use semantic versioning for the tag format
+ # * They start with the letter "v" followed by a version, or immediately start
+ # with a version
+ # * They use semantic versioning for the version format
#
# Tags not meeting these requirements are ignored.
class PreviousTagFinder
- TAG_REGEX = /\Av(?<version>#{Gitlab::Regex.unbounded_semver_regex})\z/.freeze
+ TAG_REGEX = /\Av?(?<version>#{Gitlab::Regex.unbounded_semver_regex})\z/.freeze
def initialize(project)
@project = project
@@ -36,6 +37,11 @@ module Repositories
next unless matches
+ # When using this class for generating changelog data for a range of
+ # commits, we want to compare against the tag of the last _stable_
+ # release; not some random RC that came after that.
+ next if matches[:prerelease]
+
version = matches[:version]
tags[version] = tag
versions << version