Skip to content

Commit

Permalink
Merge pull request #4984 from rtfd/no-local-branches
Browse files Browse the repository at this point in the history
Only use remote branches for our syncing.
  • Loading branch information
ericholscher authored Dec 10, 2018
2 parents 324a9f0 + bedfb31 commit e00d928
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions readthedocs/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CommunityTestSettings(CommunityDevSettings):

DEBUG = False
TEMPLATE_DEBUG = False
LOCAL_GIT_BRANCHES = True

@property
def LOGGING(self): # noqa - avoid pep8 N802
Expand Down
6 changes: 4 additions & 2 deletions readthedocs/vcs_support/backends/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import git
from builtins import str
from django.core.exceptions import ValidationError
from django.conf import settings
from git.exc import BadName

from readthedocs.config import ALL
Expand Down Expand Up @@ -177,12 +178,13 @@ 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
if repo.remotes:
branches += repo.remotes.origin.refs
if getattr(settings, 'LOCAL_GIT_BRANCHES', False):
branches += repo.branches

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

0 comments on commit e00d928

Please sign in to comment.