From f4792ac537593cea96e9ce3b0e9eba4ff36831c7 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 4 May 2021 01:32:26 +0100 Subject: [PATCH] Fix `get_latest_tag()` crash on repos with dangling tags Fixes #272 --- app/utils/git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils/git.py b/app/utils/git.py index fad9465..9ca8290 100644 --- a/app/utils/git.py +++ b/app/utils/git.py @@ -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