Fix get_latest_tag() crash on repos with dangling tags

Fixes #272
This commit is contained in:
rubenwardy 2021-05-04 01:32:26 +01:00
parent 588b03cf34
commit f4792ac537

@ -104,8 +104,8 @@ def get_latest_tag(git_url):
origin = repo.create_remote("origin", url=git_url)
origin.fetch()
refs = repo.git.ls_remote(tags=True, sort="creatordate").split('\n')
refs = [ref for ref in refs if ref.strip() != ""]
refs = repo.git.for_each_ref(sort="creatordate", format="%(objectname)\t%(refname)").split("\n")
refs = [ref for ref in refs if "refs/tags/" in ref]
if len(refs) == 0:
return None, None