Skip to content

Commit

Permalink
Return only remote branches for git backend
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Nov 28, 2018
1 parent 999a39b commit 0f6a12d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions readthedocs/vcs_support/backends/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,11 @@ def tags(self):
def branches(self):
repo = git.Repo(self.working_dir)
versions = []
branches = []

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

for branch in branches:
verbose_name = branch.name
Expand Down

0 comments on commit 0f6a12d

Please sign in to comment.