update: don't recheck taps checked in the last 1m.
This is less than ideal but it gets the time on my machine down from ~6s to ~2s when checking no taps. It still shows that we're doing way more in `update.sh` than we need to be doing but that's a future PR.
This commit is contained in:
parent
cc752e97f6
commit
2b8ea07979
@ -386,6 +386,8 @@ EOS
|
|||||||
(
|
(
|
||||||
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
||||||
then
|
then
|
||||||
|
# Skip taps checked/fetched recently
|
||||||
|
[[ -n "$(find "$DIR/.git/FETCH_HEAD" -type f -mmin -1)" ]] && exit
|
||||||
# Skip taps without formulae.
|
# Skip taps without formulae.
|
||||||
FORMULAE="$(find "$DIR" -maxdepth 1 \( -name "*.rb" -or -name Formula -or -name HomebrewFormula \) -print -quit)"
|
FORMULAE="$(find "$DIR" -maxdepth 1 \( -name "*.rb" -or -name Formula -or -name HomebrewFormula \) -print -quit)"
|
||||||
[[ -z "$FORMULAE" ]] && exit
|
[[ -z "$FORMULAE" ]] && exit
|
||||||
@ -405,6 +407,8 @@ EOS
|
|||||||
--header "Accept: application/vnd.github.v3.sha" \
|
--header "Accept: application/vnd.github.v3.sha" \
|
||||||
--header "If-None-Match: \"$UPSTREAM_BRANCH_LOCAL_SHA\"" \
|
--header "If-None-Match: \"$UPSTREAM_BRANCH_LOCAL_SHA\"" \
|
||||||
"https://api.github.com/repos/$UPSTREAM_REPOSITORY/commits/$UPSTREAM_BRANCH")"
|
"https://api.github.com/repos/$UPSTREAM_REPOSITORY/commits/$UPSTREAM_BRANCH")"
|
||||||
|
# Touch FETCH_HEAD to confirm we've checked for an update.
|
||||||
|
[[ -f "$DIR/.git/FETCH_HEAD" ]] && touch "$DIR/.git/FETCH_HEAD"
|
||||||
[[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit
|
[[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit
|
||||||
elif [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
elif [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
||||||
then
|
then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user