Skip to content

Commit

Permalink
fix(commit): Fixed typo error in the cli configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
Dranaxel committed Sep 18, 2022
1 parent b0682d5 commit 78fff83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions commitizen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
"action": "store_true",
"help": "Sign off the commit",
},
{
"name": "--allow-empty",
"action": "store_true",
"help": "Allow to create commit on an empty staging",
},
],
},
{
Expand Down
14 changes: 9 additions & 5 deletions commitizen/commands/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ def prompt_commit_questions(self) -> str:
return cz.message(answers)

def __call__(self):
dry_run: bool = self.arguments.get("dry_run")

args = []
allow_empty: bool = self.arguments.get("allow_empty")

if allow_empty:
args.append("--allow-empty")

dry_run: bool = self.arguments.get("dry_run")

if git.is_staging_clean() and not (dry_run or allow_empty):
raise NothingToCommitError("No files added to staging!")

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

if signoff:
c = git.commit(m, "-s")
else:
c = git.commit(m)
args.append("-s")

c = git.commit(m, *args)

if c.return_code != 0:
out.error(c.err)
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/test_commit_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_commit(config, mocker):
success_mock = mocker.patch("commitizen.out.success")

commands.Commit(config, {})()
success_mock.assert_called_once()
success_mock.assert_called_once()


@pytest.mark.usefixtures("staging_is_clean")
Expand Down

0 comments on commit 78fff83

Please sign in to comment.