Skip to content

Commit 746d94b

Browse files
committed
We need the identifier for branches, but not for tags and PRs
1 parent a45b42b commit 746d94b

File tree

1 file changed

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

1 file changed

+16
-4
lines changed

readthedocs/vcs_support/backends/git.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,26 @@ def get_remote_fetch_reference(self, identifier):
8989
"""
9090
Gets a valid remote reference for the identifier.
9191
92+
This method is terrible. It decides how to treat the incoming identifier from
93+
knowledge of how the caller (the build process) uses build data.
94+
95+
Build.identifier = a branch name (branches)
96+
Build.identifier = commit (tags)
97+
Build.identifier = commit (external versions)
98+
Build.verbose_name = branch alias, e.g. latest (branches)
99+
Build.verbose_name = tag name (tags)
100+
Build.verbose_name = PR number (external versions)
101+
92102
:param identifier: Should be a branch or tag name when building branches or tags.
93103
:return: A reference valid for fetch operation
94104
"""
95-
# Tags and branches have the tag/branch identifier set by the caller who instantiated the
96-
# Git backend -- this means that the build process needs to know this from build data,
97-
# essentially from an incoming webhook call.
98-
if self.version_type in (BRANCH, TAG):
105+
# Branches have the branch identifier set by the caller who instantiated the
106+
# Git backend
107+
if self.version_type == BRANCH:
99108
return identifier
109+
# Tags
110+
if self.version_type == TAG:
111+
return self.verbose_name
100112
if self.version_type == EXTERNAL:
101113

102114
# TODO: We should be able to resolve this without looking up in oauth registry

0 commit comments

Comments
 (0)