From 70b670828a018a6da96d8b20163a50c7b34705bd Mon Sep 17 00:00:00 2001 From: Adrian DC Date: Fri, 23 Aug 2024 00:49:55 +0200 Subject: [PATCH] feat(commands)!: deprecate '-s' signoff parameter Signed-off-by: Adrian DC --- commitizen/cli.py | 5 ----- commitizen/commands/commit.py | 8 +------ docs/commands/commit.md | 5 +---- tests/commands/test_commit_command.py | 22 ------------------- ...shows_description_when_use_help_option.txt | 1 - 5 files changed, 2 insertions(+), 39 deletions(-) diff --git a/commitizen/cli.py b/commitizen/cli.py index 748e4eb35..e5ff8f24c 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -146,11 +146,6 @@ def __call__( "metavar": "FILE_PATH", "help": "write message to file before committing (can be combined with --dry-run)", }, - { - "name": ["-s", "--signoff"], - "action": "store_true", - "help": "sign off the commit", - }, { "name": ["-a", "--all"], "action": "store_true", diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index 3d154abf3..48756f702 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -111,16 +111,10 @@ def __call__(self): raise DryRunExit() always_signoff: bool = self.config.settings["always_signoff"] - signoff: bool = self.arguments.get("signoff") extra_args = self.arguments.get("extra_cli_args", "") - if signoff: - out.warn( - "signoff mechanic is deprecated, please use `cz commit -- -s` instead." - ) - - if always_signoff or signoff: + if always_signoff: extra_args = f"{extra_args} -s".strip() c = git.commit(m, args=extra_args) diff --git a/docs/commands/commit.md b/docs/commands/commit.md index 7760a2b88..2f0988175 100644 --- a/docs/commands/commit.md +++ b/docs/commands/commit.md @@ -27,11 +27,8 @@ cz commit -- # e.g., cz commit --dry-run -- -a -S ``` -For example, using the `-S` option on `git commit` to sign a commit is now commitizen compatible: `cz c -- -S` -!!! note - Deprecation warning: A commit can be signed off using `cz commit --signoff` or the shortcut `cz commit -s`. - This syntax is now deprecated in favor of the new `cz commit -- -s` syntax. +For example, using the `-S` option on `git commit` to sign a commit is now commitizen compatible: `cz c -- -S` ### Retry diff --git a/tests/commands/test_commit_command.py b/tests/commands/test_commit_command.py index 9415e9dc2..af18c434e 100644 --- a/tests/commands/test_commit_command.py +++ b/tests/commands/test_commit_command.py @@ -242,28 +242,6 @@ def test_commit_command_with_invalid_write_message_to_file_option( commit_cmd() -@pytest.mark.usefixtures("staging_is_clean") -def test_commit_command_with_signoff_option(config, mocker: MockFixture): - prompt_mock = mocker.patch("questionary.prompt") - prompt_mock.return_value = { - "prefix": "feat", - "subject": "user created", - "scope": "", - "is_breaking_change": False, - "body": "", - "footer": "", - } - - commit_mock = mocker.patch("commitizen.git.commit") - commit_mock.return_value = cmd.Command("success", "", b"", b"", 0) - success_mock = mocker.patch("commitizen.out.success") - - commands.Commit(config, {"signoff": True})() - - commit_mock.assert_called_once_with(ANY, args="-s") - success_mock.assert_called_once() - - @pytest.mark.usefixtures("staging_is_clean") def test_commit_command_with_always_signoff_enabled(config, mocker: MockFixture): prompt_mock = mocker.patch("questionary.prompt") diff --git a/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt b/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt index 1cd60c8c5..d0b0a2bb9 100644 --- a/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt +++ b/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt @@ -12,7 +12,6 @@ options: --write-message-to-file FILE_PATH write message to file before committing (can be combined with --dry-run) - -s, --signoff sign off the commit -a, --all Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.