Git tags - support for multiple versions on same commit
See original GitHub issueI think that the current mechanism for getting tags (improved in #77) doesn’t pick the biggest version if you tag the same commit multiple times for the same application but for different versions.
Basically when I bump a version number for my application without doing a commit (not that common but does happen if we update a package’s dependencies) the older tag is getting picked up.
Probably easiest to illustrate just using git and the current “git describe” command:
# git init .
Initialised empty Git repository in /tmp/x/.git/
# touch x && git add x && git commit -m "test"
[master (root-commit) 217feb2] test
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 x
# git tag R_example_1.0.0
# git tag R_example_1.0.1
# git describe --tags --dirty --always --long --match "R_example*"
R_example_1.0.0-0-g217feb2
Here 1.0.0 is getting taken over 1.0.1, clearly I’d like to have 1.0.1 taken over it.
From initial googling there seems to be a way to get the current tags for a commit. I suppose you could take these all in, parse them and pick the biggest? But I guess this doesn’t give you the nice things that describe does (like dirty and commits ahead).
Issue Analytics
- State:
- Created 8 years ago
- Comments:9
Top GitHub Comments
Tagging with annotated tags not only adds the timestamp and committer account to this tag (and a message that probably nobody cares about), but also allows Git to pick the more recent tag, i.e. the one added later in time, when running
git describe
.For my purposes I added a block of code after
pieces["closest-tag"] = ...
to get the most recent tag