From cf27117c4638ff37b0803a15500d742fb5edad75 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Wed, 20 Dec 2017 16:15:19 -0800 Subject: [PATCH] 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. --- Library/Homebrew/brew.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 3299917ec5..643952a4a1 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -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