Skip to content

Commit 5772b36

Browse files
committed
feat: draft of the --empty parameter
1 parent 996bff8 commit 5772b36

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

commitizen/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@
209209
"default": None,
210210
"choices": version_types.VERSION_TYPES,
211211
},
212+
{
213+
"name": ["--empty"],
214+
"default": False,
215+
"help": "bump tags without new commits",
216+
"action": "store_true",
217+
},
212218
],
213219
},
214220
{

commitizen/commands/bump.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def __call__(self): # noqa: C901
121121
is_files_only: Optional[bool] = self.arguments["files_only"]
122122
is_local_version: Optional[bool] = self.arguments["local_version"]
123123
manual_version = self.arguments["manual_version"]
124+
is_empty: Optional[bool] = self.arguments["empty"]
124125

125126
if manual_version:
126127
if increment:
@@ -175,7 +176,7 @@ def __call__(self): # noqa: C901
175176

176177
# No commits, there is no need to create an empty tag.
177178
# Unless we previously had a prerelease.
178-
if not commits and not current_version_instance.is_prerelease:
179+
if not commits and not current_version_instance.is_prerelease and not is_empty:
179180
raise NoCommitsFoundError("[NO_COMMITS_FOUND]\n" "No new commits found.")
180181

181182
if manual_version:
@@ -208,6 +209,10 @@ def __call__(self): # noqa: C901
208209
if prerelease and current_version_instance.is_prerelease:
209210
increment = None
210211

212+
# we create an empty PATCH increment for empty tag
213+
if increment is None and is_empty:
214+
increment = "PATCH"
215+
211216
new_version = bump.generate_version(
212217
current_version,
213218
increment,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy