update: add --force argument.
Add a `brew update --force` to side-step all of the clever optimisations we have to detect if an update is unnecessary. That means if those optimisations go wrong in future we can tell people just to run this single command. This would have been a useful workaround for the issue fixed in 985c672.
This commit is contained in:
parent
97a66aa513
commit
24fb0068e7
@ -4,6 +4,8 @@
|
|||||||
#:
|
#:
|
||||||
#: If `--merge` is specified then `git merge` is used to include updates
|
#: If `--merge` is specified then `git merge` is used to include updates
|
||||||
#: (rather than `git rebase`).
|
#: (rather than `git rebase`).
|
||||||
|
#: If `--force` is specified then always do a slower, full update check even
|
||||||
|
#: if unnecessary.
|
||||||
|
|
||||||
# Hide shellcheck complaint:
|
# Hide shellcheck complaint:
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
@ -293,6 +295,7 @@ homebrew-update() {
|
|||||||
--verbose) HOMEBREW_VERBOSE=1 ;;
|
--verbose) HOMEBREW_VERBOSE=1 ;;
|
||||||
--debug) HOMEBREW_DEBUG=1 ;;
|
--debug) HOMEBREW_DEBUG=1 ;;
|
||||||
--merge) HOMEBREW_MERGE=1 ;;
|
--merge) HOMEBREW_MERGE=1 ;;
|
||||||
|
--force) HOMEBREW_UPDATE_FORCE=1 ;;
|
||||||
--simulate-from-current-branch) HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH=1 ;;
|
--simulate-from-current-branch) HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH=1 ;;
|
||||||
--preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
|
--preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
|
||||||
--*) ;;
|
--*) ;;
|
||||||
@ -393,8 +396,11 @@ EOS
|
|||||||
declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH"
|
declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH"
|
||||||
declare PREFETCH_REVISION"$TAP_VAR"="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH")"
|
declare PREFETCH_REVISION"$TAP_VAR"="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH")"
|
||||||
|
|
||||||
[[ -n "$SKIP_FETCH_BREW_REPOSITORY" && "$DIR" = "$HOMEBREW_REPOSITORY" ]] && continue
|
if [[ -z "$HOMEBREW_UPDATE_FORCE" ]]
|
||||||
[[ -n "$SKIP_FETCH_CORE_REPOSITORY" && "$DIR" = "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && continue
|
then
|
||||||
|
[[ -n "$SKIP_FETCH_BREW_REPOSITORY" && "$DIR" = "$HOMEBREW_REPOSITORY" ]] && continue
|
||||||
|
[[ -n "$SKIP_FETCH_CORE_REPOSITORY" && "$DIR" = "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && continue
|
||||||
|
fi
|
||||||
|
|
||||||
# The upstream repository's default branch may not be master;
|
# The upstream repository's default branch may not be master;
|
||||||
# check refs/remotes/origin/HEAD to see what the default
|
# check refs/remotes/origin/HEAD to see what the default
|
||||||
@ -431,7 +437,7 @@ EOS
|
|||||||
"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.
|
# Touch FETCH_HEAD to confirm we've checked for an update.
|
||||||
[[ -f "$DIR/.git/FETCH_HEAD" ]] && touch "$DIR/.git/FETCH_HEAD"
|
[[ -f "$DIR/.git/FETCH_HEAD" ]] && touch "$DIR/.git/FETCH_HEAD"
|
||||||
[[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit
|
[[ -z "$HOMEBREW_UPDATE_FORCE" ]] && [[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit
|
||||||
elif [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
elif [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
||||||
then
|
then
|
||||||
# Don't try to do a `git fetch` that may take longer than expected.
|
# Don't try to do a `git fetch` that may take longer than expected.
|
||||||
@ -484,7 +490,8 @@ EOS
|
|||||||
if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]]
|
if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]]
|
||||||
then
|
then
|
||||||
simulate_from_current_branch "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH" "$CURRENT_REVISION"
|
simulate_from_current_branch "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH" "$CURRENT_REVISION"
|
||||||
elif [[ "$PREFETCH_REVISION" = "$POSTFETCH_REVISION" ]] &&
|
elif [[ -z "$HOMEBREW_UPDATE_FORCE" ]] &&
|
||||||
|
[[ "$PREFETCH_REVISION" = "$POSTFETCH_REVISION" ]] &&
|
||||||
[[ "$CURRENT_REVISION" = "$POSTFETCH_REVISION" ]]
|
[[ "$CURRENT_REVISION" = "$POSTFETCH_REVISION" ]]
|
||||||
then
|
then
|
||||||
export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$CURRENT_REVISION"
|
export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$CURRENT_REVISION"
|
||||||
@ -499,6 +506,7 @@ EOS
|
|||||||
|
|
||||||
if [[ -n "$HOMEBREW_UPDATED" ||
|
if [[ -n "$HOMEBREW_UPDATED" ||
|
||||||
-n "$HOMEBREW_UPDATE_FAILED" ||
|
-n "$HOMEBREW_UPDATE_FAILED" ||
|
||||||
|
-n "$HOMEBREW_UPDATE_FORCE" ||
|
||||||
(-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]]
|
(-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]]
|
||||||
then
|
then
|
||||||
brew update-report "$@"
|
brew update-report "$@"
|
||||||
|
|||||||
@ -440,7 +440,9 @@ source. This is useful for creating patches for the software.</p></dd>
|
|||||||
<code>git</code>(1).</p>
|
<code>git</code>(1).</p>
|
||||||
|
|
||||||
<p>If <code>--merge</code> is specified then <code>git merge</code> is used to include updates
|
<p>If <code>--merge</code> is specified then <code>git merge</code> is used to include updates
|
||||||
(rather than <code>git rebase</code>).</p></dd>
|
(rather than <code>git rebase</code>).
|
||||||
|
If <code>--force</code> is specified then always do a slower, full update check even
|
||||||
|
if unnecessary.</p></dd>
|
||||||
<dt><code>upgrade</code> [<var>install-options</var>] [<code>--cleanup</code>] [<code>--fetch-HEAD</code>] [<var>formulae</var>]</dt><dd><p>Upgrade outdated, unpinned brews.</p>
|
<dt><code>upgrade</code> [<var>install-options</var>] [<code>--cleanup</code>] [<code>--fetch-HEAD</code>] [<var>formulae</var>]</dt><dd><p>Upgrade outdated, unpinned brews.</p>
|
||||||
|
|
||||||
<p>Options for the <code>install</code> command are also valid here.</p>
|
<p>Options for the <code>install</code> command are also valid here.</p>
|
||||||
|
|||||||
@ -597,7 +597,7 @@ Remove a tapped repository\.
|
|||||||
Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1)\.
|
Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1)\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\.
|
If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\. If \fB\-\-force\fR is specified then always do a slower, full update check even if unnecessary\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fIformulae\fR]
|
\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fIformulae\fR]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user