adamralph/minver

Allow tags with the format v1.0 or v1.1

cmenzi opened this issue · 4 comments

Use case(s)

We are currently using GitVersion, but have serval issues to create deterministic versions. Especially, when re-run a job and there is already a new commit on a branch.

We have found your tool, but as we tagged our version only with two parts v1.0 instead with 3 parts v1.0.0, minver does not recognize it as a valid version candidate.

> minver -t v -v d
MinVer: MinVer 4.2.0+ceb18d89984e30b1fef0c334be4ef906a8f536bb.
MinVer: Ignoring non-version tag { Name: v0.1, Sha: 8d01b673a913806b6eda298cfb1e0f20898ae93a }.
MinVer: Ignoring non-version tag { Name: v0.10, Sha: dbbe73e597f425e25dba383903edf525fb0f7bfb }.
MinVer: Ignoring non-version tag { Name: v0.100, Sha: 0b302604d474b9a3e1ddb7097132cf23f8650a42 }.
MinVer: Ignoring non-version tag { Name: v0.101, Sha: e0e8503da9d9be2edd9c878fa3812e8aea2985e9 }.
MinVer: Ignoring non-version tag { Name: v0.102, Sha: 3d6ffb6b75ca20fb49934615cc10912e692e2f13 }.
MinVer: Ignoring non-version tag { Name: v0.103, Sha: ab3b04c3ebfa6f83b145d2b5964c6a7107a610fb }.
MinVer: Ignoring non-version tag { Name: v0.104, Sha: 501837e06857899521edbba5677a9f9919e72ec2 }.
MinVer: Ignoring non-version tag { Name: v0.105, Sha: ffc9b36d7a96cafd6e2c7da6f6ad679da9a8e6de }.
MinVer: Ignoring non-version tag { Name: v0.11, Sha: b591d8f42641715b128b19f73b3123665218a53d }.
MinVer: Ignoring non-version tag { Name: v0.12, Sha: 8ad7d00241e3e421a55e6d8866022a29ff72a18d }.
MinVer: Ignoring non-version tag { Name: v0.13, Sha: 8b2fd282cdf278bc609337cee0a9d43211562282 }.
MinVer: Ignoring non-version tag { Name: v0.14, Sha: 80bdc5220ae97b2ec16f5200a03439dd47278ce2 }.
MinVer: Ignoring non-version tag { Name: v0.15, Sha: a96b964567e4b6deae7360340c86d91400fc9137 }.
MinVer: Ignoring non-version tag { Name: v0.16, Sha: 0a5b695f101464b4300e8cc18711a0cb6b57e99b }.
MinVer: Ignoring non-version tag { Name: v0.17, Sha: 42a571dcbbed8523832ee7eda14229b9c6cc2f76 }.
MinVer: Ignoring non-version tag { Name: v0.18, Sha: 227c8ca0255ee15c1a71ce7747c62c77e7166137 }.
MinVer: Ignoring non-version tag { Name: v0.19, Sha: d63439a00ec462f69cc1c53e98c6da089faa1044 }.
MinVer: Ignoring non-version tag { Name: v0.2, Sha: 76f1623e3736fe2dd329e5f063fda2ec8a07cab3 }.
MinVer: Ignoring non-version tag { Name: v0.20, Sha: 43c05d3701116fa8c89fe5bf9fb8e4fdba95990a }.
MinVer: Ignoring non-version tag { Name: v0.21, Sha: 7065f1e54c5fff38b8374dc2d95863a440404a8e }.
MinVer: Ignoring non-version tag { Name: v0.22, Sha: 1e23d639ee34c300caa43fbb717e19a5f77f3cd9 }.
MinVer: Ignoring non-version tag { Name: v0.23, Sha: 5cb1e2c90a3ea6f06cf5113ded75b8b7a1a264af }.
MinVer: Ignoring non-version tag { Name: v0.24, Sha: 0b81b8140522d8ffe15a6742940b4734fe1bf7c4 }.
MinVer: Ignoring non-version tag { Name: v0.25, Sha: 46a57766fc386e2b892ee431e4d0e1eb95cb89f9 }.
MinVer: Ignoring non-version tag { Name: v0.26, Sha: 9aa75886e844188afcecc67c3046ae244dd24ae6 }.
MinVer: Ignoring non-version tag { Name: v0.27, Sha: 7874bc148423a34be0ed7392bc0b9133a1adfba5 }.
MinVer: Ignoring non-version tag { Name: v0.28, Sha: 60112f085e5f99ecc2f401d8608af9df685dde90 }.
MinVer: Ignoring non-version tag { Name: v0.29, Sha: a4806411aba3957556da0d94db4257b744084f11 }.
MinVer: Ignoring non-version tag { Name: v0.3, Sha: 8462f1cdf565e099ee6acb650a4623bbfaa6ae30 }.
MinVer: Ignoring non-version tag { Name: v0.30, Sha: e0589444274d4408a15f4720d6f6944663b3bdac }.
MinVer: Ignoring non-version tag { Name: v0.31, Sha: 8e3ae9cf925d35f35b07a5f1db8f321b06bdbc3d }.
MinVer: Ignoring non-version tag { Name: v0.32, Sha: 987a299c2f94479031cf1d28ac99fceda303e8d7 }.
MinVer: Ignoring non-version tag { Name: v0.33, Sha: 2f7095899730f662504efdc98e824bffb8f28843 }.
MinVer: Ignoring non-version tag { Name: v0.34, Sha: 63bc0aef8193bec843a99ab523e9a940ad693368 }.
MinVer: Ignoring non-version tag { Name: v0.35, Sha: d3d8bb8dff5be4618f48d5f434a646623d509511 }.
MinVer: Ignoring non-version tag { Name: v0.36, Sha: 223a443c9f4926eeb73524d5ae72c66d783c8af8 }.
MinVer: Ignoring non-version tag { Name: v0.36, Sha: 223eca0cd89fe1677cb298b64fbcb39c34101eb4 }.
MinVer: Ignoring non-version tag { Name: v0.37, Sha: f0e60c1b6b0d9a6a30bef5390f41e2bbebe5bccc }.
MinVer: Ignoring non-version tag { Name: v0.37, Sha: 699ea15eef0f2f8e08d8eef456b71be2fc15cafc }.
MinVer: Ignoring non-version tag { Name: v0.38, Sha: 47aa5672298688eeeb22f899c07c0845e70d7cf4 }.
MinVer: Ignoring non-version tag { Name: v0.39, Sha: 849e1ee39aa36278234ce83fcbe2c72ec9b9cec4 }.
MinVer: Ignoring non-version tag { Name: v0.4, Sha: beeabc2e2d1f8738c79905a33522f79b81c71023 }.
MinVer: Ignoring non-version tag { Name: v0.40, Sha: 378e241404a626a0c19080241282a9354afbbb91 }.
MinVer: Ignoring non-version tag { Name: v0.41, Sha: 8c9ed76c44dd374b6b67ace97d03c008f3ba6632 }.
MinVer: Ignoring non-version tag { Name: v0.42, Sha: 0bf817f15c3d70025dc6074302507e4e0cf95c9d }.
MinVer: Ignoring non-version tag { Name: v0.43, Sha: 1ce0c0d0baa897aa2ec88ce3bf1741327a65122f }.
MinVer: Ignoring non-version tag { Name: v0.44, Sha: 2f524f7727ceab402c3b707e1e80a9122c90343c }.
MinVer: Ignoring non-version tag { Name: v0.45, Sha: 79c935c66e947fc682504980b99cc28b9e8da77d }.
MinVer: Ignoring non-version tag { Name: v0.46, Sha: d093e34928974d415e0ade9c59ce3fae4ca75b09 }.
MinVer: Ignoring non-version tag { Name: v0.47, Sha: 0b7047b8bf4d2b488d5cc66bf5e50859421e8409 }.
MinVer: Ignoring non-version tag { Name: v0.48, Sha: 9fc01bb53e4bb42e5ae50ca9ee2bcbe2640bf19f }.
MinVer: Ignoring non-version tag { Name: v0.48, Sha: 0555b905ada2043f714fd17a821a8c214a38baf8 }.
MinVer: Ignoring non-version tag { Name: v0.49, Sha: 1679a63dc31c84068cf3ed2edaadb3c29078a67c }.
MinVer: Ignoring non-version tag { Name: v0.5, Sha: 00d8b884a8e3d6e4415742e080b84ad3ba883bac }.
MinVer: Ignoring non-version tag { Name: v0.50, Sha: d728994d4bd95ae5f1422ff64f6d734ded79ed08 }.
MinVer: Ignoring non-version tag { Name: v0.51, Sha: 0464c94230c950a6889209634545db56d984d055 }.
MinVer: Ignoring non-version tag { Name: v0.52, Sha: c1b2321c7eeb02526b0c665fdaaf1ddb1c270b1d }.
MinVer: Ignoring non-version tag { Name: v0.53, Sha: 331854c519382734d579d5cc2e89d8ecea120797 }.
MinVer: Ignoring non-version tag { Name: v0.54, Sha: 747463c7dd0c4c404a656cd789bcb9ed5c5e4ef6 }.
MinVer: Ignoring non-version tag { Name: v0.55, Sha: 5d83a1cc61ff4c8eebd0afa06eb955bc2eacc0a7 }.
MinVer: Ignoring non-version tag { Name: v0.56, Sha: 3df43ba6c12ceb534ef153e8334fc5883936d324 }.
MinVer: Ignoring non-version tag { Name: v0.57, Sha: ff6c57770d34602c979c7dbffb27c87b0a9ce026 }.
MinVer: Ignoring non-version tag { Name: v0.58, Sha: 7aacac1dd386c74013f7549c3df92e58ddf5c79a }.
MinVer: Ignoring non-version tag { Name: v0.59, Sha: 7c1ad4dd8b80a582a04a8ee1b57502b61bed1cc8 }.
MinVer: Ignoring non-version tag { Name: v0.6, Sha: 0d2b958a15e83a397678950b7c747ed2305d9847 }.
MinVer: Ignoring non-version tag { Name: v0.60, Sha: 40d459b5c4a50f06a153fe4eeeab051c5db1e295 }.
MinVer: Ignoring non-version tag { Name: v0.61, Sha: 89639492126d642fad1c8b988629482fb85399f2 }.
MinVer: Ignoring non-version tag { Name: v0.63, Sha: aff073b982f2a351aa5c093c1a92f4c272f548ac }.
MinVer: Ignoring non-version tag { Name: v0.63, Sha: 86a6de839ccb38fb9c67e2d958bc7801aa170ea7 }.
MinVer: Ignoring non-version tag { Name: v0.64, Sha: e8effd05df2b2e736eaeb255d478431d40504e19 }.
MinVer: Ignoring non-version tag { Name: v0.65, Sha: ff0bead6e9ccdb1ace5128425b0c1941c54ac1a9 }.
MinVer: Ignoring non-version tag { Name: v0.66, Sha: 39d5f4b8ec65e52e38014a5bc77b37b5c1ea38b0 }.
MinVer: Ignoring non-version tag { Name: v0.67, Sha: 89ac8762fba6ff6853f19529e183aa00c33928b0 }.
MinVer: Ignoring non-version tag { Name: v0.68, Sha: 179f9507077a5ca417a6dadfaec088268387c921 }.
MinVer: Ignoring non-version tag { Name: v0.69, Sha: 841cc989a8241b613d216bdeecbed97db8da8f84 }.
MinVer: Ignoring non-version tag { Name: v0.7, Sha: f2c66b2db35a0a227bdab2a0d8dbbf0af76c1ac2 }.
MinVer: Ignoring non-version tag { Name: v0.70, Sha: 1b9bdef7e4183891a9b2a9c3d6dfd3f90943d1e7 }.
MinVer: Ignoring non-version tag { Name: v0.71, Sha: e42a0d58adfca5ab07cfa87016e64c24ba27cc9e }.
MinVer: Ignoring non-version tag { Name: v0.72, Sha: aa578a87a7e6a7af796897763ef323e71af2595e }.
MinVer: Ignoring non-version tag { Name: v0.73, Sha: 0bdf5e9e825a3a8595e694a3aa842a9b34b60df0 }.
MinVer: Ignoring non-version tag { Name: v0.74, Sha: a8af6cde9caa355ece39254a39a435392a6c751e }.
MinVer: Ignoring non-version tag { Name: v0.75, Sha: 2be587506f33f3037018b0390858ffd972550f25 }.
MinVer: Ignoring non-version tag { Name: v0.76, Sha: f4d94f1beccb5e91e31e71ebba6c7604acbda97a }.
MinVer: Ignoring non-version tag { Name: v0.77, Sha: 6418456f0e276b11c1e859cb281340537cca4788 }.
MinVer: Ignoring non-version tag { Name: v0.78, Sha: a6f714229cfaf1724ba96964c0a511e30c7e8fec }.
MinVer: Ignoring non-version tag { Name: v0.79, Sha: d8ae7a671a2a96866bfa50f1d11bc464015d21b3 }.
MinVer: Ignoring non-version tag { Name: v0.8, Sha: 4d1e34219939c497e708b2861b6c9a8294154605 }.
MinVer: Ignoring non-version tag { Name: v0.80, Sha: 01f278f30ef31a17824846a9df8a622c87b6b046 }.
MinVer: Ignoring non-version tag { Name: v0.81, Sha: ef7a3cb4f5d06ad1e9f28d8600f1dd065029e7e1 }.
MinVer: Ignoring non-version tag { Name: v0.82, Sha: b2b704c551584efe9f2b9c159766fb9ab2e92749 }.
MinVer: Ignoring non-version tag { Name: v0.83, Sha: be8d64b2bc368309b01f9a742e49df8ec25c456e }.
MinVer: Ignoring non-version tag { Name: v0.84, Sha: 1d57e25d395333cf466397a450a220b31bd8b1c3 }.
MinVer: Ignoring non-version tag { Name: v0.85, Sha: 1d57e25d395333cf466397a450a220b31bd8b1c3 }.
MinVer: Ignoring non-version tag { Name: v0.86, Sha: 6a7423defb99d86c9e8a23ae147af6ca8102e845 }.
MinVer: Ignoring non-version tag { Name: v0.87, Sha: 6fd17d8036cb4e4a47fe41b4fe6ff43e360f6932 }.
MinVer: Ignoring non-version tag { Name: v0.88, Sha: 4cd529cca92e15a9e059268cb3d5ad80f6bf92ea }.
MinVer: Ignoring non-version tag { Name: v0.89, Sha: f18a778f0782a3d0c0882baa818e36e377f10abd }.
MinVer: Ignoring non-version tag { Name: v0.9, Sha: 8c5ba6d824b5171402b75e5f66ce5ef12463f3fc }.
MinVer: Ignoring non-version tag { Name: v0.90, Sha: f18a778f0782a3d0c0882baa818e36e377f10abd }.
MinVer: Ignoring non-version tag { Name: v0.91, Sha: 0bc48f616642d29c3b07056d6ac804f620403e9d }.
MinVer: Ignoring non-version tag { Name: v0.92, Sha: 108dbe62805d2115f02d72f1f00b8daffdeb9a9b }.
MinVer: Ignoring non-version tag { Name: v0.93, Sha: c18f329b741471f7fe19a04e5726e80cff5ace4f }.
MinVer: Ignoring non-version tag { Name: v0.94, Sha: b1a39373d1b267fe0984fa158b7783293dde28a0 }.
MinVer: Ignoring non-version tag { Name: v0.95, Sha: da0b23e03f47baedb471be8347c3a54649978f82 }.
MinVer: Ignoring non-version tag { Name: v0.96, Sha: 4c6133a55bbae54a6ef8d2c3e027f68c6da5af93 }.
MinVer: Ignoring non-version tag { Name: v0.97, Sha: 95f589a4563b261f2afbbd8a8406ce77d94b28a1 }.
MinVer: Ignoring non-version tag { Name: v0.98, Sha: 1e9ba0169d2e44af81b55821f1869922787aa53b }.
MinVer: Ignoring non-version tag { Name: v0.99, Sha: 2ce9c9ade03d6e61637a4a9cfad43ff15acd2681 }.
MinVer: 1,844 commits checked.
MinVer: No commit found with a valid SemVer 2.0 version prefixed with 'v'. Using default version 0.0.0-alpha.0.
MinVer: Using { Commit: e0651cb, Tag: '', Version: 0.0.0-alpha.0, Height: 1112 }.
MinVer: The calculated version 0.0.0-alpha.0.1112 satisfies the minimum major minor 0.0.
MinVer: Calculated version 0.0.0-alpha.0.1112.
0.0.0-alpha.0.1112

The issue comes from here: https://github.com/adamralph/minver/blob/main/MinVer.Lib/Version.cs#L72

SemanticVersion.TryParse("1.0" out var version) // returns false

Description

Would it possible to allow also versions with 2 parts. For example NuGetVersion.TryParse("1.0", out var nuGetVersion); works. NuGetVersion derives from SemanticVersion and adds support for legacy versioning.

Alternatives

Retag the whole git history of 400+ gitlab projects.

Additional context

Add any other context or screenshots about the feature request here.

@cmenzi thank you for raising this. By design, MinVer does, indeed, only support valid SemVer 2.0 versions. And, as you say, 1.0 is not a valid SemVer 2.0 version. My concern with adding support for this is two-fold:

  • SemVer only supports one way of expressing a valid SemVer version. That is, I can only express 1.0.0 in one way. With that exact string. If we introduce automatic conversion of invalid versions, then we will have at least two ways of expressing 1.0.0: both 1.0.0 and 1.0. What if MinVer finds one on one branch, and one on the other? Which is right? It might be 1.0.0 in some contexts, and 1.0 in others. Sure, we could make the conversion configurable, allowing disabling/enabling, or allow configuration of precedence, but as we add all these things, complexity grows.
  • This is one example, but what other invalid SemVer versions might people start requesting support for?

These points make me reluctant to add support for this.

But let's explore your listed alternative:

Retag the whole git history of 400+ gitlab projects.

A script could probably do this fairly quickly. How about writing that script? You can run it once and then your'e done. And no complexity has been added to MinVer.

Thank you for the response.

We we really did our tagging concept without bad intentions, because of GitVersion handled this from beginning. Like the tag v1.0 implicitly produced 1.0.0 and from then on, the Patch part was incremented automatically.

I can also understand that you would like to be strict here, as it's an official specification.

I think a script could do it. Just need to ensure that no build is triggered, which should be possible. I will also try what it means if we just add the additional tag with the correct version.

Another option could also be, that we just start now with correct tagging. I guess minver will take last good candidate.

I will also try what it means if we just add the additional tag with the correct version.

As far as MinVer is concerned, that will be fine, because it will just continue to ignore the invalid (non-SemVer) tags.

I guess minver will take last good candidate.

Exactly. The presence of the older invalid (non-SemVer) tags makes no difference to how MinVer calculates the version.