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.
This commit is contained in:
Mike McQuaid 2020-07-28 11:49:50 +01:00
parent 7279e6f465
commit 0be15fc4b7
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
4 changed files with 11 additions and 3 deletions

View File

@ -518,6 +518,7 @@ update-preinstall() {
if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" ||
"$HOMEBREW_COMMAND" = "bump-formula-pr" || "$HOMEBREW_COMMAND" = "bump-formula-pr" ||
"$HOMEBREW_COMMAND" = "bundle" ||
"$HOMEBREW_COMMAND" = "tap" && $HOMEBREW_ARG_COUNT -gt 1 || "$HOMEBREW_COMMAND" = "tap" && $HOMEBREW_ARG_COUNT -gt 1 ||
"$HOMEBREW_CASK_COMMAND" = "install" || "$HOMEBREW_CASK_COMMAND" = "upgrade" ]] "$HOMEBREW_CASK_COMMAND" = "install" || "$HOMEBREW_CASK_COMMAND" = "upgrade" ]]
then then

View File

@ -1,8 +1,9 @@
#: * `update`, `up` [<options>] #: * `update` [<options>]
#: #:
#: Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. #: 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`). #: --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). #: -f, --force Always do a slower, full update check (even if unnecessary).
#: -v, --verbose Print the directories checked and `git` operations performed. #: -v, --verbose Print the directories checked and `git` operations performed.
#: -d, --debug Display a trace of all shell commands as they are executed. #: -d, --debug Display a trace of all shell commands as they are executed.

View File

@ -517,12 +517,14 @@ also `pin`.
Remove a tapped formula repository. 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. Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations.
* `--merge`: * `--merge`:
Use `git merge` to apply updates (rather than `git rebase`). 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`*] ### `update-reset` [*`repository`*]

View File

@ -671,13 +671,17 @@ Unpin \fIformula\fR, allowing them to be upgraded by \fBbrew upgrade\fR \fIformu
.SS "\fBuntap\fR \fItap\fR" .SS "\fBuntap\fR \fItap\fR"
Remove a tapped formula repository\. 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\. Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\.
. .
.TP .TP
\fB\-\-merge\fR \fB\-\-merge\fR
Use \fBgit merge\fR to apply updates (rather than \fBgit rebase\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]" .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\. Fetch and reset Homebrew and all tap repositories (or any specified \fIrepository\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\.
. .