diff --git a/docs/user/build-customization.rst b/docs/user/build-customization.rst index a7560fdfebf..56bad31b8ad 100644 --- a/docs/user/build-customization.rst +++ b/docs/user/build-customization.rst @@ -88,7 +88,8 @@ we recommend you use them as a starting point. Unshallow git clone ^^^^^^^^^^^^^^^^^^^ -Read the Docs does not perform a full clone on ``checkout`` job to reduce network data and speed up the build process. +Read the Docs does not perform a full clone in the ``checkout`` job in order to reduce network data and speed up the build process. +Instead, it performs a `shallow clone `_ and only fetches the branch or tag that you are building documentation for. Because of this, extensions that depend on the full Git history will fail. To avoid this, it's possible to unshallow the :program:`git clone`: @@ -104,6 +105,22 @@ To avoid this, it's possible to unshallow the :program:`git clone`: post_checkout: - git fetch --unshallow || true +If your build also relies on the contents of other branches, it may also be necessary to re-configure git to fetch these: + +.. code-block:: yaml + :caption: .readthedocs.yaml + + version: 2 + build: + os: "ubuntu-20.04" + tools: + python: "3.10" + jobs: + post_checkout: + - git fetch --unshallow || true + - git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' || true + - git fetch --all --tags || true + Cancel build based on a condition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^