Skip to content

Commit 911d1ff

Browse files
committed
refactor(bump): is_initial_tag
1 parent a0cc490 commit 911d1ff

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

commitizen/commands/bump.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,18 @@ def is_initial_tag(
105105
self, current_tag: git.GitTag | None, is_yes: bool = False
106106
) -> bool:
107107
"""Check if reading the whole git tree up to HEAD is needed."""
108-
is_initial = False
109-
if not current_tag:
110-
if is_yes:
111-
is_initial = True
112-
else:
113-
out.info("No tag matching configuration could not be found.")
114-
out.info(
115-
"Possible causes:\n"
116-
"- version in configuration is not the current version\n"
117-
"- tag_format or legacy_tag_formats is missing, check them using 'git tag --list'\n"
118-
)
119-
is_initial = questionary.confirm("Is this the first tag created?").ask()
120-
return is_initial
108+
if current_tag:
109+
return False
110+
if is_yes:
111+
return True
112+
113+
out.info("No tag matching configuration could not be found.")
114+
out.info(
115+
"Possible causes:\n"
116+
"- version in configuration is not the current version\n"
117+
"- tag_format or legacy_tag_formats is missing, check them using 'git tag --list'\n"
118+
)
119+
return bool(questionary.confirm("Is this the first tag created?").ask())
121120

122121
def find_increment(self, commits: list[git.GitCommit]) -> Increment | None:
123122
# Update the bump map to ensure major version doesn't increment.

0 commit comments

Comments
 (0)