diff --git a/readthedocs/vcs_support/backends/git.py b/readthedocs/vcs_support/backends/git.py index 0692825d0a1..c6313463d90 100644 --- a/readthedocs/vcs_support/backends/git.py +++ b/readthedocs/vcs_support/backends/git.py @@ -35,6 +35,7 @@ class Backend(BaseVCS): supports_branches = True supports_submodules = True fallback_branch = 'master' # default branch + repo_depth = 50 def __init__(self, *args, **kwargs): super(Backend, self).__init__(*args, **kwargs) @@ -131,7 +132,8 @@ def validate_submodules(self, config): def fetch(self): code, stdout, stderr = self.run( - 'git', 'fetch', '--tags', '--prune', '--prune-tags', + 'git', 'fetch', '--depth', str(self.repo_depth), + '--tags', '--prune', '--prune-tags', ) if code != 0: raise RepositoryError @@ -150,7 +152,8 @@ def checkout_revision(self, revision=None): def clone(self): """Clones the repository.""" code, stdout, stderr = self.run( - 'git', 'clone', self.repo_url, '.' + 'git', 'clone', '--depth', str(self.repo_depth), + '--no-single-branch', self.repo_url, '.' ) if code != 0: raise RepositoryError