Closed
Description
Description
When I run cz bump without any existing tags, an error is thrown if I have a pre_bump script configured.
This started as of version 3.16.0, versions before that had no issue.
Steps to reproduce
-
Repo with no tags.
-
Configure a simple pre_bump script.
#!/bin/bash # Standardize toml quotes set -eo pipefail main() { # sed compatible with Linux and BSD sed -i.bak "s,\"${CZ_PRE_NEW_VERSION}\",'${CZ_PRE_NEW_VERSION}',g" pyproject.toml rm pyproject.toml.bak } main
[tool.commitizen] bump_message = 'bump(RELEASE): $current_version → $new_version' pre_bump_hooks = ['.cicd-tools/boxes/bootstrap/commitizen/pre_bump.sh']
-
cz bump --increment MINOR --yes
Current behavior
poetry run cz bump --increment MINOR --yes
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
BRANCH_OR_TAG: master
pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/cicd-tools-org/cicd-tools/actions/runs/8175897168/job/22354095523#step:9:3).9.18/x6[4](https://github.com/cicd-tools-org/cicd-tools/actions/runs/8175897168/job/22354095523#step:9:4)
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
bump(RELEASE): 0.1.0 → 0.2.0
tag to create: 0.2.0
increment detected: MINOR
Traceback (most recent call last):
File "/home/runner/.cache/pypoetry/virtualenvs/cicd-tools-3sbBasnr-py3.9/bin/cz", line 8, in <module>
sys.exit(main())
File "/home/runner/.cache/pypoetry/virtualenvs/cicd-tools-3sbBasnr-py3.9/lib/python3.9/site-packages/commitizen/cli.py", line [5](https://github.com/cicd-tools-org/cicd-tools/actions/runs/8175897168/job/22354095523#step:9:5)88, in main
args.func(conf, arguments)()
File "/home/runner/.cache/pypoetry/virtualenvs/cicd-tools-3sbBasnr-py3.9/lib/python3.9/site-packages/commitizen/commands/bump.py", line 34[6](https://github.com/cicd-tools-org/cicd-tools/actions/runs/8175897168/job/22354095523#step:9:6), in __call__
is_initial=is_initial,
UnboundLocalError: local variable 'is_initial' referenced before assignment
Error: Process completed with exit code 1.
Desired behavior
The version to be bumped a minor increment, and the pre_bump script to finish as it did before.
Screenshots
No response
Environment
This is happening both in my Linux CI and on my local OSX machine.