lib/git_bumper/git.rb in git_bumper-0.1.2 vs lib/git_bumper/git.rb in git_bumper-0.1.3
- old
+ new
@@ -15,14 +15,17 @@
system('git fetch --tags >/dev/null 2>&1')
end
# Returns the greatest tag.
def greatest_tag(prefix: 'v', klass: Tag)
- output = `git tag --list --sort=-v:refname "#{prefix}[0-9]*" 2> /dev/null`
+ output = `git tag --list 2> /dev/null`
- tags = output.split.collect do |tag|
- klass.parse(tag)
- end
+ tags = output
+ .split
+ .map { |t| klass.parse(t) }
+ .select { |t| t && t.prefix == prefix }
+ .sort
+ .reverse
tags.find do |tag|
tag
end || false
end