Skip to content

Commit acf41e1

Browse files
committed
perf(tags): use set
1 parent 5013472 commit acf41e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

commitizen/tags.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ def find_tag_for(
240240
) -> GitTag | None:
241241
"""Find the first matching tag for a given version."""
242242
version = self.scheme(version) if isinstance(version, str) else version
243-
possible_tags = [
243+
possible_tags = set(
244244
self.normalize_tag(version, f)
245245
for f in (self.tag_format, *self.legacy_tag_formats)
246-
]
247-
candidates = [t for t in tags if any(t.name == p for p in possible_tags)]
246+
)
247+
candidates = [t for t in tags if t.name in possible_tags]
248248
if len(candidates) > 1:
249249
warnings.warn(
250250
UserWarning(

0 commit comments

Comments
 (0)