Skip to content

Commit 9211505

Browse files
committed
fix(bump): better match for change_type when finding increment
Closes #695
1 parent c20cb5c commit 9211505

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

commitizen/bump.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
def find_increment(
2424
commits: List[GitCommit], regex: str, increments_map: Union[dict, OrderedDict]
2525
) -> Optional[str]:
26-
2726
if isinstance(increments_map, dict):
2827
increments_map = OrderedDict(increments_map)
2928

@@ -35,16 +34,17 @@ def find_increment(
3534
for commit in commits:
3635
for message in commit.message.split("\n"):
3736
result = select_pattern.search(message)
37+
3838
if result:
39-
found_keyword = result.group(0)
39+
found_keyword = result.group(1)
4040
new_increment = None
4141
for match_pattern in increments_map.keys():
4242
if re.match(match_pattern, found_keyword):
4343
new_increment = increments_map[match_pattern]
4444
break
4545

4646
if increment == "MAJOR":
47-
continue
47+
break
4848
elif increment == "MINOR" and new_increment == "MAJOR":
4949
increment = new_increment
5050
elif increment == "PATCH" or increment is None:
@@ -103,7 +103,6 @@ def semver_generator(current_version: str, increment: str = None) -> str:
103103
# so it doesn't matter the increment.
104104
# Example: 1.0.0a0 with PATCH/MINOR -> 1.0.0
105105
if not version.is_prerelease:
106-
107106
if increment == MAJOR:
108107
increments_version[MAJOR] += 1
109108
increments_version[MINOR] = 0

commitizen/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class Settings(TypedDict, total=False):
8888
MINOR = "MINOR"
8989
PATCH = "PATCH"
9090

91-
bump_pattern = r"^(((BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?)|\w+!)"
91+
bump_pattern = r"^(((BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?)|\w+!):"
9292
bump_map = OrderedDict(
9393
(
9494
(r"^.+!$", MAJOR),

0 commit comments

Comments
 (0)