Skip to content

Commit 685e4ee

Browse files
committed
refactor(bump): rename --empty as --allow-no-commit
1 parent 6327544 commit 685e4ee

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
@@ -372,9 +372,9 @@ def __call__(
372372
"default": False,
373373
},
374374
{
375-
"name": ["--empty"],
375+
"name": ["--allow-no-commit"],
376376
"default": False,
377-
"help": "bump tags without new commits",
377+
"help": "bump version without eligible commits",
378378
"action": "store_true",
379379
},
380380
],

commitizen/commands/bump.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def __call__(self) -> None: # noqa: C901
160160
build_metadata = self.arguments["build_metadata"]
161161
increment_mode: str = self.arguments["increment_mode"]
162162
get_next: bool = self.arguments["get_next"]
163-
is_empty: bool | None = self.arguments["empty"]
163+
allow_no_commit: bool | None = self.arguments["allow_no_commit"]
164164

165165
if manual_version:
166166
if increment:
@@ -251,7 +251,11 @@ def __call__(self) -> None: # noqa: C901
251251

252252
# No commits, there is no need to create an empty tag.
253253
# Unless we previously had a prerelease.
254-
if not commits and not current_version.is_prerelease and not is_empty:
254+
if (
255+
not commits
256+
and not current_version.is_prerelease
257+
and not allow_no_commit
258+
):
255259
raise NoCommitsFoundError(
256260
"[NO_COMMITS_FOUND]\nNo new commits found."
257261
)
@@ -268,7 +272,7 @@ def __call__(self) -> None: # noqa: C901
268272
)
269273

270274
# we create an empty PATCH increment for empty tag
271-
if increment is None and is_empty:
275+
if increment is None and allow_no_commit:
272276
increment = "PATCH"
273277

274278
new_version = current_version.bump(

0 commit comments

Comments
 (0)