Closed ToneVDB closed 2 years ago
Looks good to me, a few notes:
lightweight tags
The current method for getting the latest tag ignores lightweight tags, the proposed method shows both annotated and lightweight tags. We will need to update the docs to reflect this.
sbot will keep creating annotated tags, but reading lightweight tags shouldn't be a breaking change afaik.
Windows compatibility
The head command is not available on Windows unless using WSL. We should mimic the head command in Go code.
That said, I'll have a crack at it!
TODO:
git tag
commandGetLatestAnnotatedTag
usage with the new command
Situation
We have a repo that has the following tags
Behaviour
When running
sbot creates a new tag
0.0.1
as the last tag isPROD
- This is by design at the momentExpected behaviour
sbot should ignore the first x amount of non semver tags when running the same commands the expectation is that sbot creates for example the
2.1.1
tagPotential fix
Add a --dig / --depth comand line option / config file option that searches further back to find the 'latest' semver tag This could also become the default in case the oldest tag is non-semver compliant
Example code
To retrive the last 3 tags in git, sorted by 'potential' semver structure you could use
This would yield the following example output:
'ignoring' the PROD tag.
A solution in
pkg/git/cli.go
could be: