I want my git describe invocation to use only refs
that conform to semantic versioning.
To keep it simple, for now, I do not care about other options
(like annotated tags only, branches, candidates, ...).
Example:
I have tagged an early/old commit with 1.1.1 (semver compatible),
a more recent commit with my-software-2.2.2,
and an even newer one with some-random-tag.
I want my git describe invocation to only consider the 1.1.1 tag.
The main difficulty here, seems to be that the way to limit the tags by their name is based on globs, not regex.
The best option I found so far:
Because the
--matchflag only supports primitive globs, not full regex, this check only considers very simple semver's of the forminteger.integer.integer, disregarding other valid ones, like:2.0.0-rc.22.0.0-rc.11.0.0-beta1.0.0-alpha+0011.0.0+201303131447001.0.0-beta+exp.sha.5114f851.0.0+21AF26D3—-117B344092BD