query: make get_latest_tag() always return a list

When rc=True the reversed() iterator is non-subscriptable, breaking the
sorted_tags[-1] fallback path; wrap it in list() to make it indexable.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
This commit is contained in:
Thomas Perrot 2026-05-05 17:25:00 +02:00 committed by Théo Lebrun
parent 26f20ae51c
commit ae07040c88

View file

@ -187,7 +187,7 @@ class Query:
# This excludes release candidates if `rc` is False.
def get_latest_tag(self, rc):
if rc:
sorted_tags = reversed(self.scriptLines('list-tags'))
sorted_tags = list(reversed(self.scriptLines('list-tags')))
else:
sorted_tags = self.scriptLines('get-latest-tags')