mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Reverse order of if
conditional
Checking for readability is a cheaper operation that `git diff-index`.
This commit is contained in:
parent
58ea96583f
commit
a597a1eecb
@ -458,8 +458,8 @@ if [[ -n "${GIT_REVISION}" ]]
|
|||||||
then
|
then
|
||||||
GIT_DESCRIBE_CACHE_FILE="${GIT_DESCRIBE_CACHE}/${GIT_REVISION}"
|
GIT_DESCRIBE_CACHE_FILE="${GIT_DESCRIBE_CACHE}/${GIT_REVISION}"
|
||||||
# Pass `--` to guard against `git` being confused by a file named `HEAD`.
|
# Pass `--` to guard against `git` being confused by a file named `HEAD`.
|
||||||
if "${HOMEBREW_GIT}" -C "${HOMEBREW_REPOSITORY}" diff-index --quiet --exit-code HEAD -- 2>/dev/null &&
|
if [[ -r "${GIT_DESCRIBE_CACHE_FILE}" ]] &&
|
||||||
[[ -r "${GIT_DESCRIBE_CACHE_FILE}" ]]
|
"${HOMEBREW_GIT}" -C "${HOMEBREW_REPOSITORY}" diff-index --quiet HEAD -- 2>/dev/null
|
||||||
then
|
then
|
||||||
read -r GIT_DESCRIBE_CACHE_HOMEBREW_VERSION <"${GIT_DESCRIBE_CACHE_FILE}"
|
read -r GIT_DESCRIBE_CACHE_HOMEBREW_VERSION <"${GIT_DESCRIBE_CACHE_FILE}"
|
||||||
if [[ -n "${GIT_DESCRIBE_CACHE_HOMEBREW_VERSION}" && "${GIT_DESCRIBE_CACHE_HOMEBREW_VERSION}" != *"-dirty" ]]
|
if [[ -n "${GIT_DESCRIBE_CACHE_HOMEBREW_VERSION}" && "${GIT_DESCRIBE_CACHE_HOMEBREW_VERSION}" != *"-dirty" ]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user