in src/buildstream_plugins/sources/git.py [0:0]
def reachable_tags(self, rev):
tags = set()
for options in [
[],
["--first-parent"],
["--tags"],
["--tags", "--first-parent"],
]:
exit_code, output = self.source.check_output(
[
self.source.host_git,
"describe",
"--abbrev=0",
rev,
*options,
],
cwd=self.mirror,
)
if exit_code == 0:
tag = output.strip()
_, commit_ref = self.source.check_output(
[self.source.host_git, "rev-parse", tag + "^{commit}"],
fail="Unable to resolve tag '{}'".format(tag),
cwd=self.mirror,
)
exit_code = self.source.call(
[self.source.host_git, "cat-file", "tag", tag],
cwd=self.mirror,
)
annotated = exit_code == 0
tags.add((tag, commit_ref.strip(), annotated))
return list(tags)