From bfe270da21387832829c6968a8561cca64eada84 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Fri, 27 Jul 2018 17:15:26 -0300 Subject: [PATCH 1/2] Skip tags that point to blob objects instead of commits --- readthedocs/vcs_support/backends/git.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/readthedocs/vcs_support/backends/git.py b/readthedocs/vcs_support/backends/git.py index 69a28823a1b..34e8b38b5b8 100644 --- a/readthedocs/vcs_support/backends/git.py +++ b/readthedocs/vcs_support/backends/git.py @@ -123,11 +123,18 @@ def clone(self): @property def tags(self): + versions = [] repo = git.Repo(self.working_dir) - versions = [ - VCSVersion(self, str(tag.commit), str(tag)) - for tag in repo.tags - ] + for tag in repo.tags: + try: + versions.append(VCSVersion(self, str(tag.commit), str(tag))) + except ValueError as e: + # ValueError: Cannot resolve commit as tag TAGNAME points to a + # blob object - use the `.object` property instead to access it + # This is not a real tag for us, so we skip it + # https://github.com/rtfd/readthedocs.org/issues/4440 + log.warning('[Git tag skipped] %s', e) + continue return versions @property From 33189021940c5d1f9bcea3582582f22183d211a5 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Fri, 27 Jul 2018 17:29:30 -0300 Subject: [PATCH 2/2] Show full traceback and tag name on log --- readthedocs/vcs_support/backends/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/vcs_support/backends/git.py b/readthedocs/vcs_support/backends/git.py index 34e8b38b5b8..186fa439f1f 100644 --- a/readthedocs/vcs_support/backends/git.py +++ b/readthedocs/vcs_support/backends/git.py @@ -133,7 +133,7 @@ def tags(self): # blob object - use the `.object` property instead to access it # This is not a real tag for us, so we skip it # https://github.com/rtfd/readthedocs.org/issues/4440 - log.warning('[Git tag skipped] %s', e) + log.warning('Git tag skipped: %s', tag, exc_info=True) continue return versions