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.
This commit is contained in:
parent
be336159fb
commit
7aaaf9d8db
@ -3,20 +3,11 @@ setup-analytics() {
|
|||||||
# recreated with no adverse effect (beyond our user counts being inflated).
|
# recreated with no adverse effect (beyond our user counts being inflated).
|
||||||
HOMEBREW_ANALYTICS_USER_UUID_FILE="$HOME/.homebrew_analytics_user_uuid"
|
HOMEBREW_ANALYTICS_USER_UUID_FILE="$HOME/.homebrew_analytics_user_uuid"
|
||||||
|
|
||||||
if [[ -n "$HOMEBREW_NO_ANALYTICS" ]]
|
if [[ -n "$HOMEBREW_NO_ANALYTICS" ||
|
||||||
then
|
"$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsmessage)" != "true" ||
|
||||||
rm -f "$HOMEBREW_ANALYTICS_USER_UUID_FILE"
|
"$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsdisabled)" = "true" ]]
|
||||||
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" ]]
|
|
||||||
then
|
then
|
||||||
|
[[ -f "$HOMEBREW_ANALYTICS_USER_UUID_FILE" ]] && rm -f "$HOMEBREW_ANALYTICS_USER_UUID_FILE"
|
||||||
export HOMEBREW_NO_ANALYTICS="1"
|
export HOMEBREW_NO_ANALYTICS="1"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user