Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Semantic Versioning for Git tags #16

Merged
merged 2 commits into from
Apr 5, 2018

Conversation

sigv
Copy link
Contributor

@sigv sigv commented Apr 5, 2018

Following the quick notes in f20ba12 here is a proposal for dealing with Git tags without using regular expressions - use Semantic Versioning instead.

This PR removes support for X and X.Y version tags, but supports vX.Y.Z along with X.Y.Z and full SemVer tags such as v2.3.1-rc.2+20180405. If there is a reason to add support for the X and X.Y formats, those can be squeezed in.

sigv added 2 commits April 5, 2018 18:59
With this commit regular expressions for dealing with Git tags
have been removed and replaced with a Semantic Versioning library.
This should improve maintainability there by offloading the version
voodoo as well as allow for future improvements such as warning for
major version bumps and more.

An imporant note however is that this removes support for version
tags which consist of just one number of in an X.Y format, as
Semantic Versioning mandates a complete X.Y.Z version tag at the
very least.
Simplify the flow with an if..elsif..else instead of a switchy-casey.
Really, the flow is simple enough there - just use ifs.
sigv referenced this pull request Apr 5, 2018
some modules have weird tags.
e.g.
puppetlabs-git
```
10:23 $ git ls-remote https://github.com/puppetlabs/puppetlabs-git.git | tail -3
cfbf74dbb370f00d1349d8589ba0d963d5d503eb	refs/tags/0.4.0^{}
a0cf10a8cec8728abb008fdd778e243e84dde62c	refs/tags/0.5.0
f7e4ff5cc0b8e887ff07579bb383ce9e173fb93c	refs/tags/0.5.0^{}
```
ra10ke reports this as outdated:

git is OUTDATED: 0.5.0 vs 0.5.0^{}

This fix ensures that we unly use correct version tags
@tampakrap
Copy link
Contributor

A-MA-ZING thanks a lot!

@tampakrap tampakrap merged commit 0987d22 into voxpupuli:master Apr 5, 2018
@sigv sigv deleted the git-semverse branch April 5, 2018 16:31
nil
end
end.select { |tag| !tag.nil? }.sort.last.to_s.downcase
latest_ref = tags.detect { |tag| tag.downcase == latest_tag || tag.downcase == latest_tag[1..-1] }
Copy link
Contributor Author

@sigv sigv Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In retrospect, tag.downcase == latest_tag[1..-1] here could use an extra latest_tag[0] == 'v' check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants