aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/brew.sh
diff options
context:
space:
mode:
authorShaun Jackman2017-12-20 16:15:19 -0800
committerShaun Jackman2017-12-20 16:16:01 -0800
commitcf27117c4638ff37b0803a15500d742fb5edad75 (patch)
treeef37839439140aae17797ba274c9033611ab62c8 /Library/Homebrew/brew.sh
parent426c998ff513a182aced1a5a4c4b7ec6f9203288 (diff)
downloadbrew-cf27117c4638ff37b0803a15500d742fb5edad75.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/brew.sh')
-rw-r--r--Library/Homebrew/brew.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh
index 3299917ec..643952a4a 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