Merge pull request #9501 from rgant/double-shallow-clone-check

Check for both shallow clones at the same time.
This commit is contained in:
Mike McQuaid 2020-12-14 12:31:20 +00:00 committed by GitHub
commit 77561fccc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -390,29 +390,24 @@ EOS
fi fi
fi fi
if [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/shallow" ]] [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1
then [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1
odie <<EOS
homebrew-core is a shallow clone. To \`brew update\` first run:
git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" fetch --unshallow
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core. We don't do this for you automatically to avoid
repeatedly performing an expensive unshallow operation in CI systems (which
should instead be fixed to not use shallow clones). Sorry for the inconvenience!
EOS
fi
if [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/shallow" ]] if [[ -n $HOMEBREW_CORE_SHALLOW || -n $HOMEBREW_CASK_SHALLOW ]]
then then
odie <<EOS odie <<EOS
homebrew-cask is a shallow clone. To \`brew update\` first run: ${HOMEBREW_CORE_SHALLOW:+
git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask" fetch --unshallow homebrew-core is a shallow clone.}${HOMEBREW_CASK_SHALLOW:+
homebrew-cask is a shallow clone.}
To \`brew update\`, first run:${HOMEBREW_CORE_SHALLOW:+
git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" fetch --unshallow}${HOMEBREW_CASK_SHALLOW:+
git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask" fetch --unshallow}
This restriction has been made on GitHub's request because updating shallow This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-cask. We don't do this for you automatically to avoid Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
repeatedly performing an expensive unshallow operation in CI systems (which automatically to avoid repeatedly performing an expensive unshallow operation in
should instead be fixed to not use shallow clones). Sorry for the inconvenience! CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
EOS EOS
fi fi