File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,12 @@ def __call__(
371371 "help" : "Determine the next version and write to stdout" ,
372372 "default" : False ,
373373 },
374+ {
375+ "name" : ["--empty" ],
376+ "default" : False ,
377+ "help" : "bump tags without new commits" ,
378+ "action" : "store_true" ,
379+ },
374380 ],
375381 },
376382 {
Original file line number Diff line number Diff line change @@ -160,6 +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" ]
163164
164165 if manual_version :
165166 if increment :
@@ -250,7 +251,7 @@ def __call__(self) -> None: # noqa: C901
250251
251252 # No commits, there is no need to create an empty tag.
252253 # Unless we previously had a prerelease.
253- if not commits and not current_version .is_prerelease :
254+ if not commits and not current_version .is_prerelease and not is_empty :
254255 raise NoCommitsFoundError (
255256 "[NO_COMMITS_FOUND]\n No new commits found."
256257 )
@@ -266,6 +267,10 @@ def __call__(self) -> None: # noqa: C901
266267 "To avoid this error, manually specify the type of increment with `--increment`"
267268 )
268269
270+ # we create an empty PATCH increment for empty tag
271+ if increment is None and is_empty :
272+ increment = "PATCH"
273+
269274 new_version = current_version .bump (
270275 increment ,
271276 prerelease = prerelease ,
You can’t perform that action at this time.
0 commit comments