Skip to content

Commit 7ba5c06

Browse files
committed
fix how we collect tags on current commit
1 parent 6df7ecd commit 7ba5c06

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

Diff for: tasks.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -318,20 +318,15 @@ def get_current_tags(context: Context) -> set[str]:
318318
log.error("Cannot create a tag - there are uncommitted changes")
319319
return set()
320320

321-
tags_per_commit: dict[str, list[str]] = {}
322-
for commit, tag in map(
323-
str.split,
324-
context.run(
325-
r"git for-each-ref --format '%(objectname) %(refname:short)' refs/tags",
326-
hide=True,
327-
).stdout.splitlines(),
328-
):
329-
tags_per_commit.setdefault(commit, []).append(tag)
330-
331-
current_commit = context.run(
332-
"git rev-parse HEAD", silent=True, external=True
333-
).stdout.strip()
334-
tags = set(tags_per_commit.get(current_commit, set()))
321+
# get tags for current commit
322+
tags = {
323+
line
324+
for line in map(
325+
str.strip,
326+
context.run("git tag --points-at HEAD", hide=True).stdout.splitlines(),
327+
)
328+
if line
329+
}
335330

336331
if not tags:
337332
log.error("No tags found for current commit")

0 commit comments

Comments
 (0)