diff --git a/Library/Homebrew/shims/scm/git b/Library/Homebrew/shims/scm/git index 6b0382ad6e..4f397eb386 100755 --- a/Library/Homebrew/shims/scm/git +++ b/Library/Homebrew/shims/scm/git @@ -3,7 +3,8 @@ # This script because we support $HOMEBREW_GIT, $HOMEBREW_SVN, etc., Xcode-only and # no Xcode/CLT configurations. Order is careful to be what the user would want. -if [ -z "$HOMEBREW_LIBRARY" ] +# shellcheck disable=SC2154 +if [ -z "${HOMEBREW_LIBRARY}" ] then echo "${0##*/}: This shim is internal and must be run via brew." >&2 exit 1 @@ -11,27 +12,28 @@ fi # Don't need shellcheck to follow the `source`. # shellcheck disable=SC1090 -source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh" +source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh" -case "$(lowercase "$SHIM_FILE")" in +# shellcheck disable=SC2249 +case "$(lowercase "${SHIM_FILE}")" in git) - if [[ -n "$HOMEBREW_GIT" && "$HOMEBREW_GIT" != git ]] + if [[ -n "${HOMEBREW_GIT}" && "${HOMEBREW_GIT}" != git ]] then - safe_exec "$(type -P "$HOMEBREW_GIT")" "$@" + safe_exec "$(type -P "${HOMEBREW_GIT}")" "$@" fi ;; svn) - if [[ -n "$HOMEBREW_SVN" && "$HOMEBREW_SVN" != svn ]] + if [[ -n "${HOMEBREW_SVN}" && "${HOMEBREW_SVN}" != svn ]] then - safe_exec "$(type -P "$HOMEBREW_SVN")" "$@" + safe_exec "$(type -P "${HOMEBREW_SVN}")" "$@" fi ;; esac -brew_prefix_version="$HOMEBREW_PREFIX/bin/$SHIM_FILE" -safe_exec "$brew_prefix_version" "$@" +brew_prefix_version="${HOMEBREW_PREFIX}/bin/${SHIM_FILE}" +safe_exec "${brew_prefix_version}" "$@" -try_exec_non_system "$SHIM_FILE" "$@" +try_exec_non_system "${SHIM_FILE}" "$@" if executable "/usr/bin/xcode-select" then @@ -39,28 +41,28 @@ then # /usr/bin/ will be a popup stub under such configuration. # xcrun hangs if xcode-select is set to "/" xcode_path="$(/usr/bin/xcode-select -print-path 2>/dev/null)" - if [[ -z "$xcode_path" ]] + if [[ -z "${xcode_path}" ]] then - if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -ge "100900" ]] + if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -ge "100900" ]] then popup_stub=1 fi fi - if [[ -z "$popup_stub" && "$xcode_path" != "/" ]] + if [[ -z "${popup_stub}" && "${xcode_path}" != "/" ]] then - path="$(/usr/bin/xcrun -find "$SHIM_FILE" 2>/dev/null)" - safe_exec "$path" "$@" + path="$(/usr/bin/xcrun -find "${SHIM_FILE}" 2>/dev/null)" + safe_exec "${path}" "$@" fi fi -path="/Applications/Xcode.app/Contents/Developer/usr/bin/$SHIM_FILE" -safe_exec "$path" "$@" +path="/Applications/Xcode.app/Contents/Developer/usr/bin/${SHIM_FILE}" +safe_exec "${path}" "$@" -if [[ -z "$popup_stub" && "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101500" ]] +if [[ -z "${popup_stub}" && "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "101500" ]] then - path="/usr/bin/$SHIM_FILE" - safe_exec "$path" "$@" + path="/usr/bin/${SHIM_FILE}" + safe_exec "${path}" "$@" fi -echo "You must: brew install $SHIM_FILE" >&2 +echo "You must: brew install ${SHIM_FILE}" >&2 exit 1