Skip to content

Commit 78fff83

Browse files
committed
fix(commit): Fixed typo error in the cli configuration file
1 parent b0682d5 commit 78fff83

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

commitizen/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
"action": "store_true",
6767
"help": "Sign off the commit",
6868
},
69+
{
70+
"name": "--allow-empty",
71+
"action": "store_true",
72+
"help": "Allow to create commit on an empty staging",
73+
},
6974
],
7075
},
7176
{

commitizen/commands/commit.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ def prompt_commit_questions(self) -> str:
6262
return cz.message(answers)
6363

6464
def __call__(self):
65-
dry_run: bool = self.arguments.get("dry_run")
66-
65+
args = []
6766
allow_empty: bool = self.arguments.get("allow_empty")
6867

68+
if allow_empty:
69+
args.append("--allow-empty")
70+
71+
dry_run: bool = self.arguments.get("dry_run")
72+
6973
if git.is_staging_clean() and not (dry_run or allow_empty):
7074
raise NothingToCommitError("No files added to staging!")
7175

@@ -84,9 +88,9 @@ def __call__(self):
8488
signoff: bool = self.arguments.get("signoff")
8589

8690
if signoff:
87-
c = git.commit(m, "-s")
88-
else:
89-
c = git.commit(m)
91+
args.append("-s")
92+
93+
c = git.commit(m, *args)
9094

9195
if c.return_code != 0:
9296
out.error(c.err)

tests/commands/test_commit_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_commit(config, mocker):
3838
success_mock = mocker.patch("commitizen.out.success")
3939

4040
commands.Commit(config, {})()
41-
success_mock.assert_called_once()
41+
success_mock.assert_called_once()
4242

4343

4444
@pytest.mark.usefixtures("staging_is_clean")

0 commit comments

Comments
 (0)