From 0be15fc4b731850e1f519c7936182842bbd40de4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 28 Jul 2020 11:49:50 +0100 Subject: [PATCH] Run `brew update` before `brew bundle`. This should help with cases like https://github.com/Homebrew/homebrew-bundle/issues/751 and is good practise in general. Also, document the `brew update --preinstall` flag that is being used here so others can run it manually e.g. as part of CI if needed. --- Library/Homebrew/brew.sh | 1 + Library/Homebrew/cmd/update.sh | 3 ++- docs/Manpage.md | 4 +++- manpages/brew.1 | 6 +++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index f0bafb577e..c5ffd29dda 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -518,6 +518,7 @@ update-preinstall() { if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "bump-formula-pr" || + "$HOMEBREW_COMMAND" = "bundle" || "$HOMEBREW_COMMAND" = "tap" && $HOMEBREW_ARG_COUNT -gt 1 || "$HOMEBREW_CASK_COMMAND" = "install" || "$HOMEBREW_CASK_COMMAND" = "upgrade" ]] then diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 0bd7c02db9..71530f6349 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -1,8 +1,9 @@ -#: * `update`, `up` [] +#: * `update` [] #: #: Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. #: #: --merge Use `git merge` to apply updates (rather than `git rebase`). +#: --preinstall Run on auto-updates (e.g. before `brew install`). Skips some slower steps. #: -f, --force Always do a slower, full update check (even if unnecessary). #: -v, --verbose Print the directories checked and `git` operations performed. #: -d, --debug Display a trace of all shell commands as they are executed. diff --git a/docs/Manpage.md b/docs/Manpage.md index aee66d9116..965cce3303 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -517,12 +517,14 @@ also `pin`. Remove a tapped formula repository. -### `update`, `up` [*`options`*] +### `update` [*`options`*] Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. * `--merge`: Use `git merge` to apply updates (rather than `git rebase`). +* `--preinstall`: + Run on auto-updates (e.g. before `brew install`). Skips some slower steps. ### `update-reset` [*`repository`*] diff --git a/manpages/brew.1 b/manpages/brew.1 index 8112a37a14..ab13db9755 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -671,13 +671,17 @@ Unpin \fIformula\fR, allowing them to be upgraded by \fBbrew upgrade\fR \fIformu .SS "\fBuntap\fR \fItap\fR" Remove a tapped formula repository\. . -.SS "\fBupdate\fR, \fBup\fR [\fIoptions\fR]" +.SS "\fBupdate\fR [\fIoptions\fR]" Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. . .TP \fB\-\-merge\fR Use \fBgit merge\fR to apply updates (rather than \fBgit rebase\fR)\. . +.TP +\fB\-\-preinstall\fR +Run on auto\-updates (e\.g\. before \fBbrew install\fR)\. Skips some slower steps\. +. .SS "\fBupdate\-reset\fR [\fIrepository\fR]" Fetch and reset Homebrew and all tap repositories (or any specified \fIrepository\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. .