Skip to content

Commit c37decb

Browse files
committed
feat(commands)!: deprecate '-s' signoff parameter
Signed-off-by: Adrian DC <[email protected]>
1 parent d211348 commit c37decb

File tree

5 files changed

+3
-40
lines changed

5 files changed

+3
-40
lines changed

commitizen/cli.py

-5
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@ def __call__(
146146
"metavar": "FILE_PATH",
147147
"help": "write message to file before committing (can be combined with --dry-run)",
148148
},
149-
{
150-
"name": ["-s", "--signoff"],
151-
"action": "store_true",
152-
"help": "sign off the commit",
153-
},
154149
{
155150
"name": ["-a", "--all"],
156151
"action": "store_true",

commitizen/commands/commit.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,10 @@ def __call__(self):
111111
raise DryRunExit()
112112

113113
always_signoff: bool = self.config.settings["always_signoff"]
114-
signoff: bool = self.arguments.get("signoff")
115114

116115
extra_args = self.arguments.get("extra_cli_args", "")
117116

118-
if signoff:
119-
out.warn(
120-
"signoff mechanic is deprecated, please use `cz commit -- -s` instead."
121-
)
122-
123-
if always_signoff or signoff:
117+
if always_signoff:
124118
extra_args = f"{extra_args} -s".strip()
125119

126120
c = git.commit(m, args=extra_args)

docs/commands/commit.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ cz commit <commitizen-args> -- <git-cli-args>
2727

2828
# e.g., cz commit --dry-run -- -a -S
2929
```
30-
For example, using the `-S` option on `git commit` to sign a commit is now commitizen compatible: `cz c -- -S`
3130

32-
!!! note
33-
Deprecation warning: A commit can be signed off using `cz commit --signoff` or the shortcut `cz commit -s`.
34-
This syntax is now deprecated in favor of the new `cz commit -- -s` syntax.
31+
For example, using the `-S` option on `git commit` to sign a commit is now commitizen compatible: `cz c -- -S`
3532

3633
### Retry
3734

tests/commands/test_commit_command.py

-22
Original file line numberDiff line numberDiff line change
@@ -242,28 +242,6 @@ def test_commit_command_with_invalid_write_message_to_file_option(
242242
commit_cmd()
243243

244244

245-
@pytest.mark.usefixtures("staging_is_clean")
246-
def test_commit_command_with_signoff_option(config, mocker: MockFixture):
247-
prompt_mock = mocker.patch("questionary.prompt")
248-
prompt_mock.return_value = {
249-
"prefix": "feat",
250-
"subject": "user created",
251-
"scope": "",
252-
"is_breaking_change": False,
253-
"body": "",
254-
"footer": "",
255-
}
256-
257-
commit_mock = mocker.patch("commitizen.git.commit")
258-
commit_mock.return_value = cmd.Command("success", "", b"", b"", 0)
259-
success_mock = mocker.patch("commitizen.out.success")
260-
261-
commands.Commit(config, {"signoff": True})()
262-
263-
commit_mock.assert_called_once_with(ANY, args="-s")
264-
success_mock.assert_called_once()
265-
266-
267245
@pytest.mark.usefixtures("staging_is_clean")
268246
def test_commit_command_with_always_signoff_enabled(config, mocker: MockFixture):
269247
prompt_mock = mocker.patch("questionary.prompt")

tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
usage: cz commit [-h] [--retry] [--no-retry] [--dry-run]
2-
[--write-message-to-file FILE_PATH] [-s] [-a]
2+
[--write-message-to-file FILE_PATH] [-a]
33
[-l MESSAGE_LENGTH_LIMIT] [--]
44

55
create new commit
@@ -12,7 +12,6 @@ options:
1212
--write-message-to-file FILE_PATH
1313
write message to file before committing (can be
1414
combined with --dry-run)
15-
-s, --signoff sign off the commit
1615
-a, --all Tell the command to automatically stage files that
1716
have been modified and deleted, but new files you have
1817
not told Git about are not affected.

0 commit comments

Comments
 (0)