Skip to content

Commit 999a39b

Browse files
committed
Include remote branches only if there is remotes
1 parent 59209ae commit 999a39b

File tree

1 file changed

+6
-1
lines changed
  • readthedocs/vcs_support/backends

1 file changed

+6
-1
lines changed

readthedocs/vcs_support/backends/git.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,14 @@ def tags(self):
174174
def branches(self):
175175
repo = git.Repo(self.working_dir)
176176
versions = []
177+
177178
# ``repo.branches`` returns local branches and
179+
branches = repo.branches
178180
# ``repo.remotes.origin.refs`` returns remote branches
179-
for branch in repo.branches + repo.remotes.origin.refs:
181+
if repo.remotes:
182+
branches += repo.remotes.origin.refs
183+
184+
for branch in branches:
180185
verbose_name = branch.name
181186
if verbose_name.startswith('origin/'):
182187
verbose_name = verbose_name.replace('origin/', '')

0 commit comments

Comments
 (0)