update: don't update homebrew/core for preinstall if using JSON

This commit is contained in:
Rylan Polster 2021-07-14 00:52:15 -04:00
parent 91fffeeff6
commit a0f7711ab6
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64

View File

@ -471,7 +471,7 @@ EOS
[[ -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] [[ -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]]
then then
safe_cd "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" safe_cd "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core"
echo "HOMEBREW_CORE_GIT_REMOTE set: using ${HOMEBREW_CORE_GIT_REMOTE} for Homebrew/brew Git remote." echo "HOMEBREW_CORE_GIT_REMOTE set: using ${HOMEBREW_CORE_GIT_REMOTE} for Homebrew/core Git remote."
git remote set-url origin "${HOMEBREW_CORE_GIT_REMOTE}" git remote set-url origin "${HOMEBREW_CORE_GIT_REMOTE}"
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --force origin refs/heads/master:refs/remotes/origin/master git fetch --force origin refs/heads/master:refs/remotes/origin/master
@ -498,6 +498,12 @@ EOS
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/* for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
do do
if [[ -n "${HOMEBREW_JSON_CORE}" ]] && [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
[[ "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]]
then
continue
fi
[[ -d "${DIR}/.git" ]] || continue [[ -d "${DIR}/.git" ]] || continue
cd "${DIR}" || continue cd "${DIR}" || continue
@ -639,6 +645,14 @@ EOS
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/* for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
do do
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
# shellcheck disable=SC2031
if [[ -n "${HOMEBREW_JSON_CORE}" ]] && [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
[[ "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]]
then
continue
fi
[[ -d "${DIR}/.git" ]] || continue [[ -d "${DIR}/.git" ]] || continue
cd "${DIR}" || continue cd "${DIR}" || continue