aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/update.sh
diff options
context:
space:
mode:
authorMike McQuaid2016-08-09 09:19:51 +0100
committerMike McQuaid2016-08-09 13:44:43 +0100
commit2b8ea07979da10a5edba2620a86d8111c9d2fee6 (patch)
tree22ad4181cc485c832579832eae69fad3e09a3554 /Library/Homebrew/cmd/update.sh
parentcc752e97f6dcfb3e58c9e753262926672edeb571 (diff)
downloadbrew-2b8ea07979da10a5edba2620a86d8111c9d2fee6.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/cmd/update.sh')
-rw-r--r--Library/Homebrew/cmd/update.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 744642648..98c497082 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