Skip to content

Commit

Permalink
fix(bump): version bumping
Browse files Browse the repository at this point in the history
The old implementation wrongly set the `increment` variable to `None` if
`increment = "PATCH"` and `new_increment = None`.
  • Loading branch information
jmattheis authored and Lee-W committed Oct 14, 2023
1 parent 9d0878c commit 8cf6ded
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions commitizen/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from commitizen.git import GitCommit, smart_open
from commitizen.version_schemes import DEFAULT_SCHEME, Version, VersionScheme

VERSION_TYPES = [None, PATCH, MINOR, MAJOR]


def find_increment(
commits: list[GitCommit], regex: str, increments_map: dict | OrderedDict
Expand All @@ -34,12 +36,11 @@ def find_increment(
new_increment = increments_map[match_pattern]
break

if VERSION_TYPES.index(increment) < VERSION_TYPES.index(new_increment):
increment = new_increment

if increment == MAJOR:
break
elif increment == MINOR and new_increment == MAJOR:
increment = new_increment
elif increment == PATCH or increment is None:
increment = new_increment

return increment

Expand Down

0 comments on commit 8cf6ded

Please sign in to comment.