diff options
| author | Mike McQuaid | 2016-08-14 10:00:06 +0100 |
|---|---|---|
| committer | GitHub | 2016-08-14 10:00:06 +0100 |
| commit | 611ba62a24fa8a7aba02f580f25e05f1d3a386ea (patch) | |
| tree | 03c7a33cca7054be3f8b2f390d26ed4124f5c0c4 /Library | |
| parent | fcb0b33f16277ff15be73f6747169e7c88135c85 (diff) | |
| parent | 24fb0068e7933bec7e74a632fce3c4d3d05559c4 (diff) | |
| download | brew-611ba62a24fa8a7aba02f580f25e05f1d3a386ea.tar.bz2 | |
Merge pull request #689 from MikeMcQuaid/update-force
update: add --force argument.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/update.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 68eae6c2c..ba43fd6d1 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -4,6 +4,8 @@ #: #: If `--merge` is specified then `git merge` is used to include updates #: (rather than `git rebase`). +#: If `--force` is specified then always do a slower, full update check even +#: if unnecessary. # Hide shellcheck complaint: # shellcheck source=/dev/null @@ -293,6 +295,7 @@ homebrew-update() { --verbose) HOMEBREW_VERBOSE=1 ;; --debug) HOMEBREW_DEBUG=1 ;; --merge) HOMEBREW_MERGE=1 ;; + --force) HOMEBREW_UPDATE_FORCE=1 ;; --simulate-from-current-branch) HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH=1 ;; --preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;; --*) ;; @@ -393,8 +396,11 @@ EOS declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH_DIR" declare PREFETCH_REVISION"$TAP_VAR"="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH_DIR")" - [[ -n "$SKIP_FETCH_BREW_REPOSITORY" && "$DIR" = "$HOMEBREW_REPOSITORY" ]] && continue - [[ -n "$SKIP_FETCH_CORE_REPOSITORY" && "$DIR" = "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && continue + if [[ -z "$HOMEBREW_UPDATE_FORCE" ]] + 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; # 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_DIR")" # Touch FETCH_HEAD to confirm we've checked for an update. [[ -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" ]] then # 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" ]] then 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" ]] then export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$CURRENT_REVISION" @@ -499,6 +506,7 @@ EOS if [[ -n "$HOMEBREW_UPDATED" || -n "$HOMEBREW_UPDATE_FAILED" || + -n "$HOMEBREW_UPDATE_FORCE" || (-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]] then brew update-report "$@" |
