brew.sh: Use shims/scm/git for HOMEBREW_VERSION
Move the use of git to determine HOMEBREW_VERSION below the definition of the function git.
This commit is contained in:
parent
426c998ff5
commit
cf27117c46
@ -19,14 +19,6 @@ case "$*" in
|
||||
--repository|--repo) echo "$HOMEBREW_REPOSITORY"; exit 0 ;;
|
||||
esac
|
||||
|
||||
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=">=1.4.0 (shallow or no git repository)"
|
||||
HOMEBREW_USER_AGENT_VERSION="1.X.Y"
|
||||
fi
|
||||
|
||||
# A depth of 1 means this command was directly invoked by a user.
|
||||
# Higher depths mean this command was invoked by another Homebrew command.
|
||||
export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1))
|
||||
@ -63,6 +55,14 @@ git() {
|
||||
"$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" "$@"
|
||||
}
|
||||
|
||||
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=">=1.4.0 (shallow or no git repository)"
|
||||
HOMEBREW_USER_AGENT_VERSION="1.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
|
||||
|
Loading…
x
Reference in New Issue
Block a user