Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-reset: allow specifying repositories. #4932

Merged
merged 1 commit into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 12 additions & 9 deletions Library/Homebrew/cmd/update-reset.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#: * `update-reset`:
#: Fetches and resets Homebrew and all tap repositories using `git`(1) to
#: their latest `origin/master`. Note this will destroy all your uncommitted
#: or committed changes.
#: * `update-reset` [<repositories>]:
#: Fetches and resets Homebrew and all tap repositories (or the specified
#: `repositories`) using `git`(1) to their latest `origin/master`. Note this
#: will destroy all your uncommitted or committed changes.

homebrew-update-reset() {
local DIR
local -a REPOS=()

for option in "$@"
do
Expand All @@ -15,10 +16,7 @@ homebrew-update-reset() {
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
;;
*)
odie <<EOS
This command updates brew itself, and does not take formula names.
Use 'brew upgrade <formula>'.
EOS
REPOS+=("$option")
;;
esac
done
Expand All @@ -28,7 +26,12 @@ EOS
set -x
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
[[ -d "$DIR/.git" ]] || continue
cd "$DIR" || continue
Expand Down
8 changes: 4 additions & 4 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 unnecessary.

* `update-reset`:
Fetches and resets Homebrew and all tap repositories using `git`(1) to
their latest `origin/master`. Note this will destroy all your uncommitted
or committed changes.
* `update-reset` [`repositories`]:
Fetches and resets Homebrew and all tap repositories (or the specified
`repositories`) using `git`(1) to their latest `origin/master`. Note this
will destroy all your uncommitted or committed changes.

* `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [`formulae`]:
Upgrade outdated, unpinned brews (with existing install options).
Expand Down
2 changes: 1 addition & 1 deletion manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -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\.
.
.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
\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)\.
Expand Down