diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 837dfa8bbc..6d1e74f1ed 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -9,31 +9,38 @@ #: -d, --debug Display a trace of all shell commands as they are executed. #: -h, --help Show this message. -source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh" +# HOMEBREW_CURLRC, HOMEBREW_DEVELOPER, HOMEBREW_GIT_EMAIL, HOMEBREW_GIT_NAME +# HOMEBREW_UPDATE_CLEANUP, HOMEBREW_UPDATE_TO_TAG are from the user environment +# HOMEBREW_LIBRARY, HOMEBREW_PREFIX, HOMEBREW_REPOSITORY are set by bin/brew +# HOMEBREW_BREW_DEFAULT_GIT_REMOTE, HOMEBREW_BREW_GIT_REMOTE, HOMEBREW_CACHE, HOMEBREW_CELLAR, HOMEBREW_CURL +# HOMEBREW_DEV_CMD_RUN, HOMEBREW_FORCE_BREWED_CURL, HOMEBREW_FORCE_BREWED_GIT, HOMEBREW_SYSTEM_CURL_TOO_OLD +# HOMEBREW_USER_AGENT_CURL are set by brew.sh +# shellcheck disable=SC2154 +source "${HOMEBREW_LIBRARY}/Homebrew/utils/lock.sh" # Replaces the function in Library/Homebrew/brew.sh to cache the Git executable to # provide speedup when using Git repeatedly (as update.sh does). git() { - if [[ -z "$GIT_EXECUTABLE" ]] + if [[ -z "${GIT_EXECUTABLE}" ]] then - GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" --homebrew=print-path)" + GIT_EXECUTABLE="$("${HOMEBREW_LIBRARY}/Homebrew/shims/scm/git" --homebrew=print-path)" fi - "$GIT_EXECUTABLE" "$@" + "${GIT_EXECUTABLE}" "$@" } git_init_if_necessary() { - safe_cd "$HOMEBREW_REPOSITORY" + safe_cd "${HOMEBREW_REPOSITORY}" if [[ ! -d ".git" ]] then set -e trap '{ rm -rf .git; exit 1; }' EXIT git init git config --bool core.autocrlf false - if [[ "$HOMEBREW_BREW_DEFAULT_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]] + if [[ "${HOMEBREW_BREW_DEFAULT_GIT_REMOTE}" != "${HOMEBREW_BREW_GIT_REMOTE}" ]] then - echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote URL." + echo "HOMEBREW_BREW_GIT_REMOTE set: using ${HOMEBREW_BREW_GIT_REMOTE} for Homebrew/brew Git remote URL." fi - git config remote.origin.url "$HOMEBREW_BREW_GIT_REMOTE" + git config remote.origin.url "${HOMEBREW_BREW_GIT_REMOTE}" git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git fetch --force --tags origin git remote set-head origin --auto >/dev/null @@ -43,19 +50,19 @@ git_init_if_necessary() { trap - EXIT fi - [[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] || return - safe_cd "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" + [[ -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || return + safe_cd "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" if [[ ! -d ".git" ]] then set -e trap '{ rm -rf .git; exit 1; }' EXIT git init git config --bool core.autocrlf false - if [[ "$HOMEBREW_CORE_DEFAULT_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] + if [[ "${HOMEBREW_CORE_DEFAULT_GIT_REMOTE}" != "${HOMEBREW_CORE_GIT_REMOTE}" ]] then - echo "HOMEBREW_CORE_GIT_REMOTE set: using $HOMEBREW_CORE_GIT_REMOTE for Homebrew/core Git remote URL." + echo "HOMEBREW_CORE_GIT_REMOTE set: using ${HOMEBREW_CORE_GIT_REMOTE} for Homebrew/core Git remote URL." fi - git config remote.origin.url "$HOMEBREW_CORE_GIT_REMOTE" + git config remote.origin.url "${HOMEBREW_CORE_GIT_REMOTE}" git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git fetch --force origin refs/heads/master:refs/remotes/origin/master git remote set-head origin --auto >/dev/null @@ -70,28 +77,28 @@ repo_var() { local repo_var repo_var="$1" - if [[ "$repo_var" = "$HOMEBREW_REPOSITORY" ]] + if [[ "${repo_var}" = "${HOMEBREW_REPOSITORY}" ]] then repo_var="" else - repo_var="${repo_var#"$HOMEBREW_LIBRARY/Taps"}" - repo_var="$(echo -n "$repo_var" | tr -C "A-Za-z0-9" "_" | tr "[:lower:]" "[:upper:]")" + repo_var="${repo_var#"${HOMEBREW_LIBRARY}/Taps"}" + repo_var="$(echo -n "${repo_var}" | tr -C "A-Za-z0-9" "_" | tr "[:lower:]" "[:upper:]")" fi - echo "$repo_var" + echo "${repo_var}" } upstream_branch() { local upstream_branch upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)" - if [[ -z "$upstream_branch" ]] + if [[ -z "${upstream_branch}" ]] then git remote set-head origin --auto >/dev/null upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)" fi upstream_branch="${upstream_branch#refs/remotes/origin/}" - [[ -z "$upstream_branch" ]] && upstream_branch="master" - echo "$upstream_branch" + [[ -z "${upstream_branch}" ]] && upstream_branch="master" + echo "${upstream_branch}" } read_current_revision() { @@ -99,10 +106,10 @@ read_current_revision() { } pop_stash() { - [[ -z "$STASHED" ]] && return - if [[ -n "$HOMEBREW_VERBOSE" ]] + [[ -z "${STASHED}" ]] && return + if [[ -n "${HOMEBREW_VERBOSE}" ]] then - echo "Restoring your stashed changes to $DIR..." + echo "Restoring your stashed changes to ${DIR}..." git stash pop else git stash pop "${QUIET_ARGS[@]}" 1>/dev/null @@ -111,26 +118,26 @@ pop_stash() { } pop_stash_message() { - [[ -z "$STASHED" ]] && return - echo "To restore the stashed changes to $DIR, run:" - echo " cd $DIR && git stash pop" + [[ -z "${STASHED}" ]] && return + echo "To restore the stashed changes to ${DIR}, run:" + echo " cd ${DIR} && git stash pop" unset STASHED } reset_on_interrupt() { - if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]] + if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]] then - git checkout "$INITIAL_BRANCH" "${QUIET_ARGS[@]}" + git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}" fi - if [[ -n "$INITIAL_REVISION" ]] + if [[ -n "${INITIAL_REVISION}" ]] then git rebase --abort &>/dev/null git merge --abort &>/dev/null - git reset --hard "$INITIAL_REVISION" "${QUIET_ARGS[@]}" + git reset --hard "${INITIAL_REVISION}" "${QUIET_ARGS[@]}" fi - if [[ -n "$HOMEBREW_NO_UPDATE_CLEANUP" ]] + if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]] then pop_stash else @@ -150,28 +157,28 @@ simulate_from_current_branch() { local CURRENT_REVISION DIR="$1" - cd "$DIR" || return + cd "${DIR}" || return TAP_VAR="$2" UPSTREAM_BRANCH="$3" CURRENT_REVISION="$4" - INITIAL_REVISION="$(git rev-parse -q --verify "$UPSTREAM_BRANCH")" - export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$INITIAL_REVISION" - export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$CURRENT_REVISION" - if [[ "$INITIAL_REVISION" != "$CURRENT_REVISION" ]] + INITIAL_REVISION="$(git rev-parse -q --verify "${UPSTREAM_BRANCH}")" + export HOMEBREW_UPDATE_BEFORE"${TAP_VAR}"="${INITIAL_REVISION}" + export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}" + if [[ "${INITIAL_REVISION}" != "${CURRENT_REVISION}" ]] then HOMEBREW_UPDATED="1" fi - if ! git merge-base --is-ancestor "$INITIAL_REVISION" "$CURRENT_REVISION" + if ! git merge-base --is-ancestor "${INITIAL_REVISION}" "${CURRENT_REVISION}" then - odie "Your $DIR HEAD is not a descendant of $UPSTREAM_BRANCH!" + odie "Your ${DIR} HEAD is not a descendant of ${UPSTREAM_BRANCH}!" fi } merge_or_rebase() { - if [[ -n "$HOMEBREW_VERBOSE" ]] + if [[ -n "${HOMEBREW_VERBOSE}" ]] then - echo "Updating $DIR..." + echo "Updating ${DIR}..." fi local DIR @@ -179,14 +186,14 @@ merge_or_rebase() { local UPSTREAM_BRANCH DIR="$1" - cd "$DIR" || return + cd "${DIR}" || return TAP_VAR="$2" UPSTREAM_BRANCH="$3" unset STASHED trap reset_on_interrupt SIGINT - if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -n "$HOMEBREW_UPDATE_TO_TAG" ]] + if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]] then UPSTREAM_TAG="$(git tag --list | sort --field-separator=. --key=1,1nr -k 2,2nr -k 3,3nr | @@ -195,19 +202,19 @@ merge_or_rebase() { UPSTREAM_TAG="" fi - if [ -n "$UPSTREAM_TAG" ] + if [ -n "${UPSTREAM_TAG}" ] then - REMOTE_REF="refs/tags/$UPSTREAM_TAG" + REMOTE_REF="refs/tags/${UPSTREAM_TAG}" UPSTREAM_BRANCH="stable" else - REMOTE_REF="origin/$UPSTREAM_BRANCH" + REMOTE_REF="origin/${UPSTREAM_BRANCH}" fi if [[ -n "$(git status --untracked-files=all --porcelain 2>/dev/null)" ]] then - if [[ -n "$HOMEBREW_VERBOSE" ]] + if [[ -n "${HOMEBREW_VERBOSE}" ]] then - echo "Stashing uncommitted changes to $DIR..." + echo "Stashing uncommitted changes to ${DIR}..." fi git merge --abort &>/dev/null git rebase --abort &>/dev/null @@ -217,9 +224,9 @@ merge_or_rebase() { stash save --include-untracked "${QUIET_ARGS[@]}" then odie </dev/null + if [[ -z "${UPSTREAM_TAG}" ]] && + git merge-base --is-ancestor "${UPSTREAM_BRANCH}" "${REMOTE_REF}" &>/dev/null then - git checkout --force "$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}" + git checkout --force "${UPSTREAM_BRANCH}" "${QUIET_ARGS[@]}" else - if [[ -n "$UPSTREAM_TAG" && "$UPSTREAM_BRANCH" != "master" ]] + if [[ -n "${UPSTREAM_TAG}" && "${UPSTREAM_BRANCH}" != "master" ]] then git checkout --force -B "master" "origin/master" "${QUIET_ARGS[@]}" fi - git checkout --force -B "$UPSTREAM_BRANCH" "$REMOTE_REF" "${QUIET_ARGS[@]}" + git checkout --force -B "${UPSTREAM_BRANCH}" "${REMOTE_REF}" "${QUIET_ARGS[@]}" fi fi INITIAL_REVISION="$(read_current_revision)" - export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$INITIAL_REVISION" + export HOMEBREW_UPDATE_BEFORE"${TAP_VAR}"="${INITIAL_REVISION}" # ensure we don't munge line endings on checkout git config core.autocrlf false - if [[ -z "$HOMEBREW_MERGE" ]] + if [[ -z "${HOMEBREW_MERGE}" ]] then # Work around bug where git rebase --quiet is not quiet - if [[ -z "$HOMEBREW_VERBOSE" ]] + if [[ -z "${HOMEBREW_VERBOSE}" ]] then - git rebase "${QUIET_ARGS[@]}" "$REMOTE_REF" >/dev/null + git rebase "${QUIET_ARGS[@]}" "${REMOTE_REF}" >/dev/null else - git rebase "${QUIET_ARGS[@]}" "$REMOTE_REF" + git rebase "${QUIET_ARGS[@]}" "${REMOTE_REF}" fi else - git merge --no-edit --ff "${QUIET_ARGS[@]}" "$REMOTE_REF" \ + git merge --no-edit --ff "${QUIET_ARGS[@]}" "${REMOTE_REF}" \ --strategy=recursive \ --strategy-option=ours \ --strategy-option=ignore-all-space fi CURRENT_REVISION="$(read_current_revision)" - export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$CURRENT_REVISION" + export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}" - if [[ "$INITIAL_REVISION" != "$CURRENT_REVISION" ]] + if [[ "${INITIAL_REVISION}" != "${CURRENT_REVISION}" ]] then HOMEBREW_UPDATED="1" fi trap '' SIGINT - if [[ -n "$HOMEBREW_NO_UPDATE_CLEANUP" ]] + if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]] then - if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" && - ! "$INITIAL_BRANCH" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]] + if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" && + ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]] then - git checkout "$INITIAL_BRANCH" "${QUIET_ARGS[@]}" + git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}" fi pop_stash @@ -302,7 +309,7 @@ homebrew-update() { for option in "$@" do - case "$option" in + case "${option}" in -\?|-h|--help|--usage) brew help update; exit $? ;; --verbose) HOMEBREW_VERBOSE=1 ;; --debug) HOMEBREW_DEBUG=1 ;; @@ -313,10 +320,10 @@ homebrew-update() { --preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;; --*) ;; -*) - [[ "$option" = *v* ]] && HOMEBREW_VERBOSE=1 - [[ "$option" = *q* ]] && HOMEBREW_QUIET=1 - [[ "$option" = *d* ]] && HOMEBREW_DEBUG=1 - [[ "$option" = *f* ]] && HOMEBREW_UPDATE_FORCE=1 + [[ "${option}" = *v* ]] && HOMEBREW_VERBOSE=1 + [[ "${option}" = *q* ]] && HOMEBREW_QUIET=1 + [[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1 + [[ "${option}" = *f* ]] && HOMEBREW_UPDATE_FORCE=1 ;; *) odie </dev/null || - [[ -n "$HOMEBREW_FORCE_BREWED_GIT" && - ! -x "$HOMEBREW_PREFIX/opt/git/bin/git" ]] + [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && + ! -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] then # we cannot install a Homebrew Git if homebrew/core is unavailable. - if [[ ! -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] || ! brew install git + if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install git then odie "'git' must be installed and in your PATH!" fi fi - [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1 - [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1 - if [[ -n $HOMEBREW_CORE_SHALLOW && -n $HOMEBREW_CASK_SHALLOW ]] + [[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1 + [[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1 + if [[ -n ${HOMEBREW_CORE_SHALLOW} && -n ${HOMEBREW_CASK_SHALLOW} ]] then SHALLOW_COMMAND_PHRASE="These commands" SHALLOW_REPO_PHRASE="repositories" @@ -396,15 +403,15 @@ EOS SHALLOW_REPO_PHRASE="repository" fi - if [[ -n $HOMEBREW_CORE_SHALLOW || -n $HOMEBREW_CASK_SHALLOW ]] + if [[ -n ${HOMEBREW_CORE_SHALLOW} || -n ${HOMEBREW_CASK_SHALLOW} ]] then odie </dev/null + "refs/heads/${UPSTREAM_BRANCH_DIR}:refs/remotes/origin/${UPSTREAM_BRANCH_DIR}" 2>/dev/null else # Capture stderr to tmp_failure_file if ! git fetch --tags --force "${QUIET_ARGS[@]}" origin \ - "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR" 2>>"$tmp_failure_file" + "refs/heads/${UPSTREAM_BRANCH_DIR}:refs/remotes/origin/${UPSTREAM_BRANCH_DIR}" 2>>"${tmp_failure_file}" then # Reprint fetch errors to stderr - [[ -f "$tmp_failure_file" ]] && cat "$tmp_failure_file" 1>&2 + [[ -f "${tmp_failure_file}" ]] && cat "${tmp_failure_file}" 1>&2 - if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]] + if [[ "${UPSTREAM_SHA_HTTP_CODE}" = "404" ]] then - TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}" - echo "$TAP does not exist! Run \`brew untap $TAP\` to remove it." >>"$update_failed_file" + TAP="${DIR#${HOMEBREW_LIBRARY}/Taps/}" + echo "${TAP} does not exist! Run \`brew untap ${TAP}\` to remove it." >>"${update_failed_file}" else - echo "Fetching $DIR failed!" >>"$update_failed_file" + echo "Fetching ${DIR} failed!" >>"${update_failed_file}" - if [[ -f "$tmp_failure_file" ]] && - [[ "$(<"$tmp_failure_file")" = "fatal: couldn't find remote ref refs/heads/$UPSTREAM_BRANCH_DIR" ]] + if [[ -f "${tmp_failure_file}" ]] && + [[ "$(<"${tmp_failure_file}")" = "fatal: couldn't find remote ref refs/heads/${UPSTREAM_BRANCH_DIR}" ]] then - echo "$DIR" >>"$missing_remote_ref_dirs_file" + echo "${DIR}" >>"${missing_remote_ref_dirs_file}" fi fi fi fi - rm -f "$tmp_failure_file" + rm -f "${tmp_failure_file}" ) & done wait trap - SIGINT - if [[ -f "$update_failed_file" ]] + if [[ -f "${update_failed_file}" ]] then - onoe <"$update_failed_file" - rm -f "$update_failed_file" + onoe <"${update_failed_file}" + rm -f "${update_failed_file}" export HOMEBREW_UPDATE_FAILED="1" fi - if [[ -f "$missing_remote_ref_dirs_file" ]] + if [[ -f "${missing_remote_ref_dirs_file}" ]] then - HOMEBREW_MISSING_REMOTE_REF_DIRS="$(<"$missing_remote_ref_dirs_file")" - rm -f "$missing_remote_ref_dirs_file" + HOMEBREW_MISSING_REMOTE_REF_DIRS="$(<"${missing_remote_ref_dirs_file}")" + rm -f "${missing_remote_ref_dirs_file}" export HOMEBREW_MISSING_REMOTE_REF_DIRS fi - for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/* + for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/* do - [[ -d "$DIR/.git" ]] || continue - cd "$DIR" || continue + [[ -d "${DIR}/.git" ]] || continue + cd "${DIR}" || continue - TAP_VAR="$(repo_var "$DIR")" - UPSTREAM_BRANCH_VAR="UPSTREAM_BRANCH$TAP_VAR" + TAP_VAR="$(repo_var "${DIR}")" + UPSTREAM_BRANCH_VAR="UPSTREAM_BRANCH${TAP_VAR}" UPSTREAM_BRANCH="${!UPSTREAM_BRANCH_VAR}" CURRENT_REVISION="$(read_current_revision)" - PREFETCH_REVISION_VAR="PREFETCH_REVISION$TAP_VAR" + PREFETCH_REVISION_VAR="PREFETCH_REVISION${TAP_VAR}" PREFETCH_REVISION="${!PREFETCH_REVISION_VAR}" - POSTFETCH_REVISION="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH")" + POSTFETCH_REVISION="$(git rev-parse -q --verify refs/remotes/origin/"${UPSTREAM_BRANCH}")" # HOMEBREW_UPDATE_FORCE and HOMEBREW_VERBOSE weren't modified in subshell. # shellcheck disable=SC2031 - if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]] + if [[ -n "${HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH}" ]] then - simulate_from_current_branch "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH" "$CURRENT_REVISION" - elif [[ -z "$HOMEBREW_UPDATE_FORCE" ]] && - [[ "$PREFETCH_REVISION" = "$POSTFETCH_REVISION" ]] && - [[ "$CURRENT_REVISION" = "$POSTFETCH_REVISION" ]] + simulate_from_current_branch "${DIR}" "${TAP_VAR}" "${UPSTREAM_BRANCH}" "${CURRENT_REVISION}" + elif [[ -z "${HOMEBREW_UPDATE_FORCE}" ]] && + [[ "${PREFETCH_REVISION}" = "${POSTFETCH_REVISION}" ]] && + [[ "${CURRENT_REVISION}" = "${POSTFETCH_REVISION}" ]] then - export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$CURRENT_REVISION" - export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$CURRENT_REVISION" + export HOMEBREW_UPDATE_BEFORE"${TAP_VAR}"="${CURRENT_REVISION}" + export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}" else - merge_or_rebase "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH" - [[ -n "$HOMEBREW_VERBOSE" ]] && echo + merge_or_rebase "${DIR}" "${TAP_VAR}" "${UPSTREAM_BRANCH}" + [[ -n "${HOMEBREW_VERBOSE}" ]] && echo fi done - safe_cd "$HOMEBREW_REPOSITORY" + safe_cd "${HOMEBREW_REPOSITORY}" # HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell. # shellcheck disable=SC2031 - if [[ -n "$HOMEBREW_UPDATED" || - -n "$HOMEBREW_UPDATE_FAILED" || - -n "$HOMEBREW_FAILED_FETCH_DIRS" || - -n "$HOMEBREW_UPDATE_FORCE" || - -d "$HOMEBREW_LIBRARY/LinkedKegs" || - ! -f "$HOMEBREW_CACHE/all_commands_list.txt" || - (-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]] + if [[ -n "${HOMEBREW_UPDATED}" || + -n "${HOMEBREW_UPDATE_FAILED}" || + -n "${HOMEBREW_MISSING_REMOTE_REF_DIRS}" || + -n "${HOMEBREW_UPDATE_FORCE}" || + -d "${HOMEBREW_LIBRARY}/LinkedKegs" || + ! -f "${HOMEBREW_CACHE}/all_commands_list.txt" || + (-n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_PREINSTALL}") ]] then brew update-report "$@" return $? - elif [[ -z "$HOMEBREW_UPDATE_PREINSTALL" && - -z "$HOMEBREW_QUIET" ]] + elif [[ -z "${HOMEBREW_UPDATE_PREINSTALL}" && + -z "${HOMEBREW_QUIET}" ]] then echo "Already up-to-date." fi