aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils/analytics.sh
diff options
context:
space:
mode:
authorAndrew Janke2016-04-26 04:28:38 -0400
committerAndrew Janke2016-04-26 04:28:38 -0400
commit05efd70dc350bf60c47d25d1d48da188ffb504df (patch)
tree7360f602e8bc7258f7845d9423156f7e19dafa67 /Library/Homebrew/utils/analytics.sh
parent7aaaf9d8dbfd3c8dc7045de434f8f79206922164 (diff)
downloadbrew-05efd70dc350bf60c47d25d1d48da188ffb504df.tar.bz2
Analytics: Separate user-supplied and internal-use DISABLE_ANALYTICS (#155)
This prevents `brew` self-calls from interacting with the stickiness of HOMEBREW_NO_ANALYTICS being persisted to the brew repo and accidentally disabling analytics permanently when it should have been for just one run, while restoring the stickiness of an explicit user-supplied HOMEBREW_NO_ANALYTICS.
Diffstat (limited to 'Library/Homebrew/utils/analytics.sh')
-rw-r--r--Library/Homebrew/utils/analytics.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh
index 70e698f7c..3c6fc59a0 100644
--- a/Library/Homebrew/utils/analytics.sh
+++ b/Library/Homebrew/utils/analytics.sh
@@ -3,12 +3,19 @@ setup-analytics() {
# recreated with no adverse effect (beyond our user counts being inflated).
HOMEBREW_ANALYTICS_USER_UUID_FILE="$HOME/.homebrew_analytics_user_uuid"
- if [[ -n "$HOMEBREW_NO_ANALYTICS" ||
- "$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsmessage)" != "true" ||
+ # Make disabling anlytics sticky
+ if [[ -n "$HOMEBREW_NO_ANALYTICS" ]]
+ then
+ git config --file="$HOMEBREW_REPOSITORY/.git/config" --replace-all homebrew.analyticsdisabled true
+ # Internal variable for brew's use, to differentiate from user-supplied setting
+ export HOMEBREW_NO_ANALYTICS_THIS_RUN="1"
+ fi
+
+ if [[ "$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsmessage)" != "true" ||
"$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsdisabled)" = "true" ]]
then
[[ -f "$HOMEBREW_ANALYTICS_USER_UUID_FILE" ]] && rm -f "$HOMEBREW_ANALYTICS_USER_UUID_FILE"
- export HOMEBREW_NO_ANALYTICS="1"
+ export HOMEBREW_NO_ANALYTICS_THIS_RUN="1"
return
fi
@@ -34,7 +41,7 @@ setup-analytics() {
}
report-analytics-screenview-command() {
- [[ -n "$HOMEBREW_NO_ANALYTICS" ]] && return
+ [[ -n "$HOMEBREW_NO_ANALYTICS" || -n "$HOMEBREW_NO_ANALYTICS_THIS_RUN" ]] && return
# Don't report non-official commands.
if ! [[ "$HOMEBREW_COMMAND" = "bundle" ||