Merge pull request #17179 from Homebrew/auto_update_tap

This commit is contained in:
Carlo Cabrera 2024-04-30 09:02:53 +01:00 committed by GitHub
commit 25d8c07a31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -278,9 +278,30 @@ auto-update() {
then
export HOMEBREW_AUTO_UPDATING="1"
# Look for commands that may be referring to a formula/cask in a specific
# 3rd-party tap so they can be auto-updated more often (as they do not get
# their data from the API).
AUTO_UPDATE_TAP_COMMANDS=(
install
outdated
upgrade
)
if check-array-membership "${HOMEBREW_COMMAND}" "${AUTO_UPDATE_TAP_COMMANDS[@]}"
then
for arg in "$@"
do
if [[ "${arg}" == */*/* ]] && [[ "${arg}" != Homebrew/* ]] && [[ "${arg}" != homebrew/* ]]
then
HOMEBREW_AUTO_UPDATE_TAP="1"
break
fi
done
fi
if [[ -z "${HOMEBREW_AUTO_UPDATE_SECS}" ]]
then
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API}" ]]
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API}" || -n "${HOMEBREW_AUTO_UPDATE_TAP}" ]]
then
# 5 minutes
HOMEBREW_AUTO_UPDATE_SECS="300"
@ -326,6 +347,7 @@ auto-update() {
brew update --auto-update
unset HOMEBREW_AUTO_UPDATING
unset HOMEBREW_AUTO_UPDATE_TAP
# Restore user path as it'll be refiltered by HOMEBREW_BREW_FILE (bin/brew)
export PATH=${HOMEBREW_PATH}