knadh / gtbump

git tag bump: A simple utility to bump and manage git semantic version tags and generate Markdown changelogs.
MIT License
20 stars 6 forks source link

issue with projects with tags #1

Open anooshcnayak opened 3 years ago

anooshcnayak commented 3 years ago

I have a repo with tags already present. gtbump doesn't seem to work with tags already present in the repo

image

What am I missing here?

knadh commented 3 years ago

What does git describe --abbrev=0 say?

Your --show shows v0.0.1 as the latest tag, but git tag | tail -2 shows v0.1.0, an entirely different minor version. From this, it looks like you have semver tags in incorrect order.

gtbump is working as expected. It is bumping v0.0.1 to v0.0.2, but your repo already has the v0.0.2 at some point.

anooshcnayak commented 3 years ago

git describe --abbrev=0 shows v0.0.1

Note: git describe --abbrev=0 --tags shows v0.1.0-20.8 -- shows all tags not just annotated

I'm attaching all the tags created (below image). I don't think I have messed up the semver order.

image

knadh commented 3 years ago

Ah, that explains it. gtbump only looks at annotated tags. Will change this.

anooshcnayak commented 3 years ago

@knadh The change in the below line to return all tags should fix the issue. I could only see that this could affect backward compatibility & need to add a flag/option to consider non-annotated tags also. Is there any other issue you see with the fix? I was thinking of raising a PR? https://github.com/knadh/gtbump/blob/0fd740c8245de3175a46307f002c481863ba77e8/gtbump/__init__.py#L38

knadh commented 3 years ago

You can send a PR. Adding this shouldn't break backwards compatibility.

bryanpedini commented 2 years ago

@knadh may I ask if tags without the v prefix are supported or will ever be in the future? (perhaps with a config like git config --global user.name)

if necessary I can open a new issue and/or create a PR for this, maybe with --noprefix or a custom --prefix '<prefix>' for example...

knadh commented 2 years ago

@bryanpedini the tool was created specifically for semver but a --prefix flag should be fine. Please feel free to send a PR.

bryanpedini commented 2 years ago

looking at the specification I thought SemVer actually didn't like the prefix, that's why I asked... will definitely put up a PR for custom --prefix and perhaps a way to store a custom prefix setting globally that can be remembered by the program as soon as possible.