8000 fix(bump): version bumping · sacha-c/commitizen@8cf6ded · GitHub
[go: up one dir, main page]

Skip to content

Commit 8cf6ded

Browse files
jmattheisLee-W
authored andcommitted
fix(bump): version bumping
The old implementation wrongly set the `increment` variable to `None` if `increment = "PATCH"` and `new_increment = None`.
1 parent 9d0878c commit 8cf6ded

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

commitizen/bump.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from commitizen.git import GitCommit, smart_open
1111
from commitizen.version_schemes import DEFAULT_SCHEME, Version, VersionScheme
1212
13+
VERSION_TYPES = [None, PATCH, MINOR, MAJOR]
14+
1315

1416
def find_increment(
1517
commits: list[GitCommit], regex: str, increments_map: dict | OrderedDict
@@ -34,12 +36,11 @@ def find_increment(
3436
new_increment = increments_map[match_pattern]
3537
break
3638

39+
if VERSION_TYPES.index(increment) < VERSION_TYPES.index(new_increment):
40+
increment = new_increment
41+
3742
if increment == MAJOR:
3843
break
39-
elif increment == MINOR and new_increment == MAJOR:
40-
increment = new_increment
41-
elif increment == PATCH or increment is None:
42-
increment = new_increment
4344

4445
return increment
4546

0 commit comments

Comments
 (0)
0