Skip to content

Commit cfc3ead

Browse files
committed
refactor(bump): rename --empty as --allow-no-commit
1 parent dfa64ea commit cfc3ead

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

commitizen/cli.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ def __call__(
337337
"default": None,
338338
},
339339
{
340-
"name": ["--empty"],
340+
"name": ["--allow-no-commit"],
341341
"default": False,
342-
"help": "bump tags without new commits",
342+
"help": "bump version without eligible commits",
343343
"action": "store_true",
344344
},
345345
],

commitizen/commands/bump.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def __call__(self) -> None: # noqa: C901
159159
manual_version = self.arguments["manual_version"]
160160
build_metadata = self.arguments["build_metadata"]
161161
increment_mode: str = self.arguments["increment_mode"]
162-
is_empty: bool | None = self.arguments["empty"]
162+
allow_no_commit: bool | None = self.arguments["allow_no_commit"]
163163

164164
if manual_version:
165165
if increment:
@@ -232,7 +232,11 @@ def __call__(self) -> None: # noqa: C901
232232

233233
# No commits, there is no need to create an empty tag.
234234
# Unless we previously had a prerelease.
235-
if not commits and not current_version.is_prerelease and not is_empty:
235+
if (
236+
not commits
237+
and not current_version.is_prerelease
238+
and not allow_no_commit
239+
):
236240
raise NoCommitsFoundError(
237241
"[NO_COMMITS_FOUND]\n" "No new commits found."
238242
)
@@ -249,7 +253,7 @@ def __call__(self) -> None: # noqa: C901
249253
)
250254

251255
# we create an empty PATCH increment for empty tag
252-
if increment is None and is_empty:
256+
if increment is None and allow_no_commit:
253257
increment = "PATCH"
254258

255259
new_version = current_version.bump(

0 commit comments

Comments
 (0)