Background / existing situation
The version detection in git_deploy will:
- Use git describe --tags to find the most recent tag name.
- Match this tag name against a regex.
If the most recent tag name does not match, it gives up.
Problem
But what if the most recent tag was just something created for local development, while there is a second most recent tag that does match the regex?
E.g.
{commit id} (HEAD -> 7.x-2.x)
{commit id}
{commit id} (tag: LOCALTEST)
{commit id}
{commit id}
{commit id} (tag: 7.x-2.2)
{commit id}
In this scenario, the version detection would find LOCALTEST and give up, because it does not match the expected format.
Proposed change
First try the describe --tags, as before.
This will work in 99% of cases.
(We could try --match=*.x-*.*, but then we'd have to run it twice to also detect -alpha* versions, and in the end we would still not be 100% safe. This is glob, not regex, unfortunately.)
If this fails, use git log --simplify-by-decoration --format=format:%D.
This produces output like this (from an example project where I had some named local tags)
tag: 7.x-2.x-1511112-53-combined
tag: 7.x-2.x-1511112-50-static-cache-per-git-dir
HEAD, tag: xxxx, origin/HEAD, origin/7.x-2.x, 7.x-2.x
tag: 7.x-2.2
tag: 7.x-2.1
tag: 7.x-2.0
We can use a regex to extract the first tag that matches our expected format, like so:
https://3v4l.org/EoTrg
Comments
Comment #2
darren ohLogic for version detection is fixed in #1254200-6: Fix dev release time. Please review and test.