Skip to content

Commit bd1b6b2

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

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

commitizen/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,9 @@ def __call__(
343343
"default": None,
344344
},
345345
{
346-
"name": ["--empty"],
346+
"name": ["--allow-no-commit"],
347347
"default": False,
348-
"help": "bump tags without new commits",
348+
"help": "bump version without eligible commits",
349349
"action": "store_true",
350350
},
351351
],

commitizen/commands/bump.py

Lines changed: 7 additions & 3 deletions
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)