From 0f6a12d225704cc2a299dbfd54a57a4607840806 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 28 Nov 2018 09:37:09 +0100 Subject: [PATCH] Return only remote branches for git backend --- readthedocs/vcs_support/backends/git.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/readthedocs/vcs_support/backends/git.py b/readthedocs/vcs_support/backends/git.py index 69e0adae338..a64acc848ca 100644 --- a/readthedocs/vcs_support/backends/git.py +++ b/readthedocs/vcs_support/backends/git.py @@ -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