Skip to content

Commit 12b214e

Browse files
ScrockyLee-W
Scrocky
authored andcommitted
refactor(git.py): Removed 'extra_args' from git.commit
1 parent 82879ab commit 12b214e

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

‎commitizen/commands/commit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __call__(self):
105105
else:
106106
extra_args = self.arguments.get("extra_cli_args", "")
107107

108-
c = git.commit(m, extra_args=extra_args)
108+
c = git.commit(m, args=extra_args)
109109

110110
if c.return_code != 0:
111111
out.error(c.err)

‎commitizen/git.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,13 @@ def add(args: str = "") -> cmd.Command:
100100
def commit(
101101
message: str,
102102
args: str = "",
103-
extra_args: str = "",
104103
committer_date: str | None = None,
105104
) -> cmd.Command:
106105
f = NamedTemporaryFile("wb", delete=False)
107106
f.write(message.encode("utf-8"))
108107
f.close()
109108

110-
command = f"git commit {args} {extra_args} -F {f.name}"
109+
command = f"git commit {args} -F {f.name}"
111110

112111
if committer_date and os.name == "nt": # pragma: no cover
113112
# Using `cmd /v /c "{command}"` sets environment variables only for that command

‎tests/commands/test_commit_command.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_commit_retry_works(config, mocker: MockFixture):
8888

8989
commands.Commit(config, {"retry": True})()
9090

91-
commit_mock.assert_called_with("feat: user created\n\ncloses #21", extra_args="")
91+
commit_mock.assert_called_with("feat: user created\n\ncloses #21", args="")
9292
prompt_mock.assert_called_once()
9393
success_mock.assert_called_once()
9494
assert not os.path.isfile(temp_file)
@@ -174,7 +174,7 @@ def test_commit_command_with_signoff_option(config, mocker: MockFixture):
174174

175175
commands.Commit(config, {"signoff": True})()
176176

177-
commit_mock.assert_called_once_with(ANY, extra_args="-- -s")
177+
commit_mock.assert_called_once_with(ANY, args="-- -s")
178178
success_mock.assert_called_once()
179179

180180

@@ -197,7 +197,7 @@ def test_commit_command_with_always_signoff_enabled(config, mocker: MockFixture)
197197
config.settings["always_signoff"] = True
198198
commands.Commit(config, {})()
199199

200-
commit_mock.assert_called_once_with(ANY, extra_args="-- -s")
200+
commit_mock.assert_called_once_with(ANY, args="-- -s")
201201
success_mock.assert_called_once()
202202

203203

@@ -294,5 +294,5 @@ def test_commit_command_with_extra_args(config, mocker: MockFixture):
294294
commit_mock.return_value = cmd.Command("success", "", b"", b"", 0)
295295
success_mock = mocker.patch("commitizen.out.success")
296296
commands.Commit(config, {"extra_cli_args": "-- -extra-args1 -extra-arg2"})()
297-
commit_mock.assert_called_once_with(ANY, extra_args="-- -extra-args1 -extra-arg2")
297+
commit_mock.assert_called_once_with(ANY, args="-- -extra-args1 -extra-arg2")
298298
success_mock.assert_called_once()

0 commit comments

Comments
 (0)