aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorXu Cheng2016-04-26 15:53:52 +0800
committerXu Cheng2016-04-26 15:53:52 +0800
commit7aaaf9d8dbfd3c8dc7045de434f8f79206922164 (patch)
tree49c45d34a64acef2e6e899e6991c372a98bb7e39 /Library/Homebrew
parentbe336159fb967b1b0855614aeaff885d45e7a96a (diff)
downloadbrew-7aaaf9d8dbfd3c8dc7045de434f8f79206922164.tar.bz2
fix setup-analytics (#154)
DO not invoke git config because HOMEBREW_NO_ANALYTICS, otherwise it will disable analytics for everyone when running `brew update` in following manners: * `brew update` will set HOMEBREW_NO_ANALYTICS because the absence of `homebrew.analyticsmessage` * `brew update-report` will set `homebrew.analyticsdisabled` because of HOMEBREW_NO_ANALYTICS. Also reduce file IO.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/utils/analytics.sh17
1 files changed, 4 insertions, 13 deletions
diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh
index e851fec92..70e698f7c 100644
--- a/Library/Homebrew/utils/analytics.sh
+++ b/Library/Homebrew/utils/analytics.sh
@@ -3,20 +3,11 @@ 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" ]]
- then
- rm -f "$HOMEBREW_ANALYTICS_USER_UUID_FILE"
- git config --file="$HOMEBREW_REPOSITORY/.git/config" --replace-all homebrew.analyticsdisabled true
- fi
-
- if [[ "$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsmessage)" != "true" ]]
- then
- export HOMEBREW_NO_ANALYTICS="1"
- return
- fi
-
- if [[ "$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsdisabled)" = "true" ]]
+ if [[ -n "$HOMEBREW_NO_ANALYTICS" ||
+ "$(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"
return
fi