diff options
| author | Mike McQuaid | 2016-10-01 18:24:09 +0100 |
|---|---|---|
| committer | GitHub | 2016-10-01 18:24:09 +0100 |
| commit | 19e633f1900ea910c2a9db85dc7c7bea0825676d (patch) | |
| tree | 70628b3c3c5acee05c77c09f3c8becd8e0172de8 /Library/Homebrew | |
| parent | 32e992ae2fc0d7a44a227cbe27d514d28a4bb6ba (diff) | |
| parent | e0d39cc3efdc91078184caf5210b88a14d6bae55 (diff) | |
| download | brew-19e633f1900ea910c2a9db85dc7c7bea0825676d.tar.bz2 | |
Merge pull request #1203 from alyssais/analytics_depth
analytics: don't report commands run by Homebrew
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/brew.sh | 4 | ||||
| -rw-r--r-- | Library/Homebrew/utils/analytics.sh | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 22ebb87ed..1ccd8832a 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -4,6 +4,10 @@ then HOMEBREW_VERSION=">1.0.0 (no git repository)" 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)) + onoe() { if [[ -t 2 ]] # check whether stderr is a tty. then diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh index 24839709e..19b341fdc 100644 --- a/Library/Homebrew/utils/analytics.sh +++ b/Library/Homebrew/utils/analytics.sh @@ -70,6 +70,9 @@ setup-analytics() { report-analytics-screenview-command() { [[ -n "$HOMEBREW_NO_ANALYTICS" || -n "$HOMEBREW_NO_ANALYTICS_THIS_RUN" ]] && return + # Don't report commands that are invoked as part of other commands. + [[ "$HOMEBREW_COMMAND_DEPTH" != 1 ]] && return + # Don't report non-official commands. if ! [[ "$HOMEBREW_COMMAND" = "bundle" || "$HOMEBREW_COMMAND" = "services" || |
