diff options
| author | Mike McQuaid | 2016-12-18 15:25:16 -0800 |
|---|---|---|
| committer | Mike McQuaid | 2016-12-18 15:25:18 -0800 |
| commit | d21f6954b647948b35da41ca8d02e80880ede2b6 (patch) | |
| tree | 06d3a137f675fcdab8ca65be0d4eaffb4afb2cdb /Library | |
| parent | 482568579b8c9e699ca19207643cc483975869a4 (diff) | |
| download | brew-d21f6954b647948b35da41ca8d02e80880ede2b6.tar.bz2 | |
update-reset: add new command.
Add new `brew update-reset` command to provide a helpful troubleshooting
fallback to fetch and reset all repositories. This could have lived in
`brew update` but it makes sense to avoid the complexity of sharing
logic between these scripts and keeping this one simpler.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/update-reset.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh new file mode 100644 index 000000000..32daffc96 --- /dev/null +++ b/Library/Homebrew/cmd/update-reset.sh @@ -0,0 +1,43 @@ +#: @hide_from_man_page +#: * `update-reset`: +#: Fetches and resets Homebrew and all tap repositories using `git`(1) to +#: their latest `origin/master`. + +homebrew-update-reset() { + local DIR + + for option in "$@" + do + case "$option" in + -\?|-h|--help|--usage) brew help update-reset; exit $? ;; + --debug) HOMEBREW_DEBUG=1 ;; + -*) + [[ "$option" = *d* ]] && HOMEBREW_DEBUG=1 + ;; + *) + odie <<EOS +This command updates brew itself, and does not take formula names. +Use 'brew upgrade <formula>'. +EOS + ;; + esac + done + + if [[ -n "$HOMEBREW_DEBUG" ]] + then + set -x + fi + + for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/* + do + [[ -d "$DIR/.git" ]] || continue + cd "$DIR" || continue + echo "==> Fetching $DIR..." + git fetch --tags --force origin + echo + + echo "==> Resetting $DIR..." + git checkout -B master origin/master + echo + done +} |
