markchalloner / git-semver

Git plugin for Semantic Versioning
MIT License
382 stars 43 forks source link

Fix failure to sort properly with prefix, sort double numbers (#43 #44). #46

Open john-tipper opened 4 years ago

john-tipper commented 4 years ago

Tags were not being sorted properly if there was a prefix, as the numerical sort included the prefix in the first sort field. We grep this out via a capture group of the remainder of the tag, sort, then add the prefix back in if required. This also fixes the issue with double numbers.

The version being reported in get to the user (at the end of version-get()) was using an unsorted list of tags, so use the new sorted list for actually getting the version.