Merge pull request #4932 from MikeMcQuaid/update-reset-repos

update-reset: allow specifying repositories.
This commit is contained in:
Mike McQuaid 2018-09-18 21:36:26 +01:00 committed by GitHub
commit 7c4b9f2274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 14 deletions

View File

@ -1,10 +1,11 @@
#: * `update-reset`: #: * `update-reset` [<repositories>]:
#: Fetches and resets Homebrew and all tap repositories using `git`(1) to #: Fetches and resets Homebrew and all tap repositories (or the specified
#: their latest `origin/master`. Note this will destroy all your uncommitted #: `repositories`) using `git`(1) to their latest `origin/master`. Note this
#: or committed changes. #: will destroy all your uncommitted or committed changes.
homebrew-update-reset() { homebrew-update-reset() {
local DIR local DIR
local -a REPOS=()
for option in "$@" for option in "$@"
do do
@ -15,10 +16,7 @@ homebrew-update-reset() {
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1 [[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
;; ;;
*) *)
odie <<EOS REPOS+=("$option")
This command updates brew itself, and does not take formula names.
Use 'brew upgrade <formula>'.
EOS
;; ;;
esac esac
done done
@ -28,7 +26,12 @@ EOS
set -x set -x
fi fi
for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/* if [[ -z "$REPOS" ]]
then
REPOS+=("$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*)
fi
for DIR in ${REPOS[@]}
do do
[[ -d "$DIR/.git" ]] || continue [[ -d "$DIR/.git" ]] || continue
cd "$DIR" || continue cd "$DIR" || continue

View File

@ -578,10 +578,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--force` (or `-f`) is specified then always do a slower, full update check even If `--force` (or `-f`) is specified then always do a slower, full update check even
if unnecessary. if unnecessary.
* `update-reset`: * `update-reset` [`repositories`]:
Fetches and resets Homebrew and all tap repositories using `git`(1) to Fetches and resets Homebrew and all tap repositories (or the specified
their latest `origin/master`. Note this will destroy all your uncommitted `repositories`) using `git`(1) to their latest `origin/master`. Note this
or committed changes. will destroy all your uncommitted or committed changes.
* `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [`formulae`]: * `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [`formulae`]:
Upgrade outdated, unpinned brews (with existing install options). Upgrade outdated, unpinned brews (with existing install options).

View File

@ -527,7 +527,7 @@ If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates
If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\. If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBupdate\-reset\fR: Fetches and resets Homebrew and all tap repositories using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. \fBupdate\-reset\fR [\fIrepositories\fR]: Fetches and resets Homebrew and all tap repositories (or the specified \fBrepositories\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-display\-times\fR] [\fIformulae\fR]: Upgrade outdated, unpinned brews (with existing install options)\. \fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-display\-times\fR] [\fIformulae\fR]: Upgrade outdated, unpinned brews (with existing install options)\.