cmd/update-reset: fix errors when the git shim changes in a brew update

This commit is contained in:
Bo Anderson 2021-10-05 03:38:40 +01:00
parent 28e4c9c5d9
commit 549eaa1563
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -4,6 +4,18 @@
#:
#: *Note:* this will destroy all your uncommitted or committed changes.
# Replaces the function in Library/Homebrew/brew.sh to cache the Git executable to provide
# speedup when using Git repeatedly and prevent errors if the shim changes mid-update.
git() {
if [[ -z "${GIT_EXECUTABLE}" ]]
then
# HOMEBREW_LIBRARY is set by bin/brew
# shellcheck disable=SC2154
GIT_EXECUTABLE="$("${HOMEBREW_LIBRARY}/Homebrew/shims/shared/git" --homebrew=print-path)"
fi
"${GIT_EXECUTABLE}" "$@"
}
homebrew-update-reset() {
local DIR
local -a REPOS=()