Merge pull request #8663 from maxim-belkin/use-homebrew-git-variable

brew.sh: use HOMEBREW_GIT to detect HOMEBREW_VERSION
This commit is contained in:
Mike McQuaid 2020-09-10 08:41:19 +01:00 committed by GitHub
commit cfa03c8cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,14 +106,6 @@ numeric() {
printf "%01d%02d%02d%03d" ${1//[.rc]/ } 2>/dev/null
}
HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)"
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
if [[ -z "$HOMEBREW_VERSION" ]]
then
HOMEBREW_VERSION=">=2.2.0 (shallow or no git repository)"
HOMEBREW_USER_AGENT_VERSION="2.X.Y"
fi
if [[ "$HOMEBREW_PREFIX" = "/" || "$HOMEBREW_PREFIX" = "/usr" ]]
then
# it may work, but I only see pain this route and don't want to support it
@ -144,6 +136,14 @@ else
HOMEBREW_GIT="git"
fi
HOMEBREW_VERSION="$("$HOMEBREW_GIT" -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)"
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
if [[ -z "$HOMEBREW_VERSION" ]]
then
HOMEBREW_VERSION=">=2.5.0 (shallow or no git repository)"
HOMEBREW_USER_AGENT_VERSION="2.X.Y"
fi
if [[ -n "$HOMEBREW_MACOS" ]]
then
HOMEBREW_PRODUCT="Homebrew"