Skip to content

Commit ff0139d

Browse files
humitosagjohnson
authored andcommitted
Skip tags that point to blob objects instead of commits (#4442)
* Skip tags that point to blob objects instead of commits * Show full traceback and tag name on log
1 parent 20e28ca commit ff0139d

File tree

1 file changed

+11
-4
lines changed
  • readthedocs/vcs_support/backends

1 file changed

+11
-4
lines changed

readthedocs/vcs_support/backends/git.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,18 @@ def clone(self):
123123

124124
@property
125125
def tags(self):
126+
versions = []
126127
repo = git.Repo(self.working_dir)
127-
versions = [
128-
VCSVersion(self, str(tag.commit), str(tag))
129-
for tag in repo.tags
130-
]
128+
for tag in repo.tags:
129+
try:
130+
versions.append(VCSVersion(self, str(tag.commit), str(tag)))
131+
except ValueError as e:
132+
# ValueError: Cannot resolve commit as tag TAGNAME points to a
133+
# blob object - use the `.object` property instead to access it
134+
# This is not a real tag for us, so we skip it
135+
# https://github.com/rtfd/readthedocs.org/issues/4440
136+
log.warning('Git tag skipped: %s', tag, exc_info=True)
137+
continue
131138
return versions
132139

133140
@property

0 commit comments

Comments
 (0)