Skip to content

Commit

Permalink
Include remote branches only if there is remotes
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Nov 21, 2018
1 parent 59209ae commit 999a39b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion readthedocs/vcs_support/backends/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,14 @@ def tags(self):
def branches(self):
repo = git.Repo(self.working_dir)
versions = []

# ``repo.branches`` returns local branches and
branches = repo.branches
# ``repo.remotes.origin.refs`` returns remote branches
for branch in repo.branches + repo.remotes.origin.refs:
if repo.remotes:
branches += repo.remotes.origin.refs

for branch in branches:
verbose_name = branch.name
if verbose_name.startswith('origin/'):
verbose_name = verbose_name.replace('origin/', '')
Expand Down

0 comments on commit 999a39b

Please sign in to comment.