Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cf9c847

Browse files
committed
fix(commit): resolve 'always_signoff' configuration and '-s' CLI issues
If 'always_signoff' is enabled in configurations, or '-s' is used alone on the CLI, the following errors arise due to 'git commit' argument failures : > signoff mechanic is deprecated, please use `cz commit -- -s` instead. > fatal: /tmp/...: '/tmp/... is outside repository at '...' Signed-off-by: Adrian DC <radian.dc@gmail.com>
1 parent 01fd042 commit cf9c847

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

‎commitizen/commands/commit.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ def __call__(self):
114114
self.arguments.get("signoff") or self.config.settings["always_signoff"]
115115
)
116116

117+
extra_args = self.arguments.get("extra_cli_args", "")
118+
117119
if signoff:
118120
out.warn(
119121
"signoff mechanic is deprecated, please use `cz commit -- -s` instead."
120122
)
121-
extra_args=self.arguments.get("extra_cli_args", "--") +" -s"
122-
else:
123-
extra_args =self.arguments.get("extra_cli_args", "")
123+
ifextra_args:
124+
extra_args+=" "
125+
extra_args +="-s"
124126

125127
c = git.commit(m, args=extra_args)
126128

‎tests/commands/test_commit_command.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_commit_command_with_signoff_option(config, mocker: MockFixture):
260260

261261
commands.Commit(config, {"signoff": True})()
262262

263-
commit_mock.assert_called_once_with(ANY, args="-- -s")
263+
commit_mock.assert_called_once_with(ANY, args="-s")
264264
success_mock.assert_called_once()
265265

266266

@@ -283,7 +283,7 @@ def test_commit_command_with_always_signoff_enabled(config, mocker: MockFixture)
283283
config.settings["always_signoff"] = True
284284
commands.Commit(config, {})()
285285

286-
commit_mock.assert_called_once_with(ANY, args="-- -s")
286+
commit_mock.assert_called_once_with(ANY, args="-s")
287287
success_mock.assert_called_once()
288288

289289

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /