Skip to content

Commit 9d1da77

Browse files
committed
feat: allow amend! prefix as created by git --fixup=reword:<commit>
https://git-scm.com/docs/git-commit/2.32.0#Documentation/git-commit.txt---fixupamendrewordcommit
1 parent b76301d commit 9d1da77

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

commitizen/defaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class Settings(TypedDict, total=False):
9292
"Pull request",
9393
"fixup!",
9494
"squash!",
95+
"amend!",
9596
],
9697
"changelog_file": "CHANGELOG.md",
9798
"changelog_format": None, # default guessed from changelog_file

tests/commands/test_check_command.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,3 +452,11 @@ def test_check_command_with_message_length_limit_exceeded(config, mocker: MockFi
452452
with pytest.raises(InvalidCommitMessageError):
453453
check_cmd()
454454
error_mock.assert_called_once()
455+
456+
457+
def test_check_command_with_amend_prefix_default(config, mocker: MockFixture):
458+
success_mock = mocker.patch("commitizen.out.success")
459+
check_cmd = commands.Check(config=config, arguments={"message": "amend! test"})
460+
461+
check_cmd()
462+
success_mock.assert_called_once()

tests/test_conf.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@
7777
"bump_message": None,
7878
"retry_after_failure": False,
7979
"allow_abort": False,
80-
"allowed_prefixes": ["Merge", "Revert", "Pull request", "fixup!", "squash!"],
80+
"allowed_prefixes": [
81+
"Merge",
82+
"Revert",
83+
"Pull request",
84+
"fixup!",
85+
"squash!",
86+
"amend!",
87+
],
8188
"version_files": ["commitizen/__version__.py", "pyproject.toml"],
8289
"style": [["pointer", "reverse"], ["question", "underline"]],
8390
"changelog_file": "CHANGELOG.md",
@@ -108,7 +115,14 @@
108115
"bump_message": None,
109116
"retry_after_failure": False,
110117
"allow_abort": False,
111-
"allowed_prefixes": ["Merge", "Revert", "Pull request", "fixup!", "squash!"],
118+
"allowed_prefixes": [
119+
"Merge",
120+
"Revert",
121+
"Pull request",
122+
"fixup!",
123+
"squash!",
124+
"amend!",
125+
],
112126
"version_files": ["commitizen/__version__.py", "pyproject.toml"],
113127
"style": [["pointer", "reverse"], ["question", "underline"]],
114128
"changelog_file": "CHANGELOG.md",

0 commit comments

Comments
 (0)