c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.06k stars 134 forks source link

Unable to create lightweight git tags with bumpversion.cfg configuration #146

Closed vEpiphyte closed 3 years ago

vEpiphyte commented 4 years ago

Hello bump2version team,

The default behavior of a call like bump2version --verbose patch is to create an annotated tag, using the default text provided through argparse.If bump2version --verbose --tag-message='' patch is called, then things work as expected. I cannot figure out how to make lightweight git tags with bump2version when using bumpversion.cfg to manage the version configuration. All values set to the tag_message value are interpreted as the string of the value, so even with the configuration like the following an annotated commit is created

[bumpversion]
current_version = 2.0.1
commit = True
tag = True
tag_message = ""

from dry-run output..


Would prepare Git commit
Would add changes in file 'setup.py' to Git
Would add changes in file '.bumpversion.cfg' to Git
Would commit to Git with message 'Bump version: 2.0.1 → 2.0.2'
Would tag 'v2.0.2' with message '""' in Git and not signing

I am managed dozens of projects across multiple maintainers, and need their processes to be driven by configuration files. Requiring maintainers to remember a command line flag for a simple version bump is non-ideal. An incorrect tag can cause issues with downstream processes not executing (see https://discuss.circleci.com/t/checkout-fails-on-workflow-triggered-by-annotated-git-tag/27272 ) so having this feature supported by configuration files is important to reduce the risk of error.

ekohl commented 4 years ago

tag_message = ""

The quotes are not being interpreted but taken literally as can be seen here:

Would tag 'v2.0.2' with message '""' in Git and not signing

I think you need to use tag_message = instead

vEpiphyte commented 4 years ago

@ekohl Thanks - that works with bump2version for me. Would be worth noting that in the docs since it was non-trivial to sort that config out.

ekohl commented 4 years ago

Would you be willing to submit a PR for that?

vEpiphyte commented 4 years ago

@ekohl Yes I can!

loichuder commented 3 years ago

I stumbled on this today...

In fact, I would expect the default behavior to create non-annotated tags as explained by the docs.

What is the consensus ? Should the documentation reflect the current behaviour (create annotated tags by default) or should the default behaviour be changed (to create lightweight tags) ?

ekohl commented 3 years ago

IMHO projects doing releases should always use annotated tags so git describe works without having to pass git describe --all. That means the documentation should reflect the current behavior. In fact, the whole reason this project initially forked bumpversion was to create annotated tags.