From 2b8ea07979da10a5edba2620a86d8111c9d2fee6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 9 Aug 2016 09:19:51 +0100 Subject: [PATCH] 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. --- Library/Homebrew/cmd/update.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 7446426483..98c4970820 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -386,6 +386,8 @@ EOS ( if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]] then + # Skip taps checked/fetched recently + [[ -n "$(find "$DIR/.git/FETCH_HEAD" -type f -mmin -1)" ]] && exit # Skip taps without formulae. FORMULAE="$(find "$DIR" -maxdepth 1 \( -name "*.rb" -or -name Formula -or -name HomebrewFormula \) -print -quit)" [[ -z "$FORMULAE" ]] && exit @@ -405,6 +407,8 @@ EOS --header "Accept: application/vnd.github.v3.sha" \ --header "If-None-Match: \"$UPSTREAM_BRANCH_LOCAL_SHA\"" \ "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 elif [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]] then