Merge pull request #18503 from Homebrew/fix-stderr-redirections

This commit is contained in:
Carlo Cabrera 2024-10-04 19:08:28 +08:00 committed by GitHub
commit bc9a3c4f16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -445,13 +445,13 @@ GIT_REVISION=$("${HOMEBREW_GIT}" -C "${HOMEBREW_REPOSITORY}" rev-parse HEAD 2>/d
# safe fallback in case git rev-parse fails e.g. if this is not considered a safe git directory
if [[ -z "${GIT_REVISION}" ]]
then
read -r GIT_HEAD <"${HOMEBREW_REPOSITORY}/.git/HEAD" 2>/dev/null
read -r GIT_HEAD 2>/dev/null <"${HOMEBREW_REPOSITORY}/.git/HEAD"
if [[ "${GIT_HEAD}" == "ref: refs/heads/master" ]]
then
read -r GIT_REVISION <"${HOMEBREW_REPOSITORY}/.git/refs/heads/master" 2>/dev/null
read -r GIT_REVISION 2>/dev/null <"${HOMEBREW_REPOSITORY}/.git/refs/heads/master"
elif [[ "${GIT_HEAD}" == "ref: refs/heads/stable" ]]
then
read -r GIT_REVISION <"${HOMEBREW_REPOSITORY}/.git/refs/heads/stable" 2>/dev/null
read -r GIT_REVISION 2>/dev/null <"${HOMEBREW_REPOSITORY}/.git/refs/heads/stable"
fi
unset GIT_HEAD
fi