Skip to content

Commit

Permalink
Feature flag: remove DONT_SHALLOW_CLONE (#10588)
Browse files Browse the repository at this point in the history
* Feature flag: remove `DONT_SHALLOW_CLONE`

This can be done now by using `build.jobs.post_checkout`.
See an example at https://docs.readthedocs.io/en/latest/build-customization.html#unshallow-git-clone

* Use a different `start_time` to make the API call valid

* Resolve merge conflict

* Solve merge conflict

* Move code to simplify diff

* Remove double space
  • Loading branch information
humitos authored Aug 22, 2023
1 parent bcac962 commit 200f9a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
5 changes: 0 additions & 5 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,6 @@ def add_features(sender, **kwargs):
# may be added by other packages
MKDOCS_THEME_RTD = "mkdocs_theme_rtd"
API_LARGE_DATA = "api_large_data"
DONT_SHALLOW_CLONE = "dont_shallow_clone"
CONDA_APPEND_CORE_REQUIREMENTS = "conda_append_core_requirements"
ALL_VERSIONS_IN_HTML_CONTEXT = "all_versions_in_html_context"
CDN_ENABLED = "cdn_enabled"
Expand Down Expand Up @@ -1969,10 +1968,6 @@ def add_features(sender, **kwargs):
MKDOCS_THEME_RTD,
_("MkDocs: Use Read the Docs theme for MkDocs as default theme"),
),
(
DONT_SHALLOW_CLONE,
_("Build: Do not shallow clone when cloning git repos"),
),
(
API_LARGE_DATA,
_("Build: Try alternative method of posting large data"),
Expand Down
14 changes: 1 addition & 13 deletions readthedocs/vcs_support/backends/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def get_remote_fetch_refspec(self):
)

def clone(self):
"""Clones the repository."""
# TODO: We should add "--no-checkout" in all git clone operations, except:
# There exists a case of version_type=BRANCH without a branch name.
# This case is relevant for building projects for the first time without knowing the name
Expand Down Expand Up @@ -268,19 +269,6 @@ def validate_submodules(self, config):
return False, invalid_submodules
return True, submodules.keys()

def use_shallow_clone(self):
"""
Test whether shallow clone should be performed.
.. note::
Temporarily, we support skipping this option as builds that rely on
git history can fail if using shallow clones. This should
eventually be configurable via the web UI.
"""
from readthedocs.projects.models import Feature
return not self.project.has_feature(Feature.DONT_SHALLOW_CLONE)

def checkout_revision(self, revision):
try:
code, out, err = self.run('git', 'checkout', '--force', revision)
Expand Down

0 comments on commit 200f9a8

Please sign in to comment.