{"action":"created","comment":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/comments/61664882","id":61664882,"diff_hunk":"@@ -1,30 +1,45 @@\n setup-analytics() {\n-  # User UUID file. Used for Homebrew user counting. Can be deleted and\n-  # recreated with no adverse effect (beyond our user counts being inflated).\n-  HOMEBREW_ANALYTICS_USER_UUID_FILE=\"$HOME/.homebrew_analytics_user_uuid\"\n+  local git_config_file=\"$HOMEBREW_REPOSITORY/.git/config\"\n+\n+  # Migrate analytics UUID to its new home in Homebrew repo's git config and\n+  # remove the legacy UUID file if detected.\n+  migrate_legacy_uuid_file () {","path":"Library/Homebrew/utils/analytics.sh","position":9,"original_position":9,"commit_id":"baa44b2f19b822b38c0633960f1be8154b61967a","original_commit_id":"baa44b2f19b822b38c0633960f1be8154b61967a","user":{"login":"zmwangx","id":4149852,"avatar_url":"https://avatars.githubusercontent.com/u/4149852?v=3","gravatar_id":"","url":"https://api.github.com/users/zmwangx","html_url":"https://github.com/zmwangx","followers_url":"https://api.github.com/users/zmwangx/followers","following_url":"https://api.github.com/users/zmwangx/following{/other_user}","gists_url":"https://api.github.com/users/zmwangx/gists{/gist_id}","starred_url":"https://api.github.com/users/zmwangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmwangx/subscriptions","organizations_url":"https://api.github.com/users/zmwangx/orgs","repos_url":"https://api.github.com/users/zmwangx/repos","events_url":"https://api.github.com/users/zmwangx/events{/privacy}","received_events_url":"https://api.github.com/users/zmwangx/received_events","type":"User","site_admin":false},"body":"@xu-cheng I put `migrate_legacy_uuid_file` inside solely because it's part of `setup-analytics` logically speaking. There's no \"local function\" in bash, once you evaluate it, it's available everywhere (which is why I unset it after using it to keep the global scope as clean as possible). I can surely move it out, but it shouldn't be called from elsewhere anyway.","created_at":"2016-04-30T04:41:41Z","updated_at":"2016-04-30T04:41:41Z","html_url":"https://github.com/Homebrew/brew/pull/162#discussion_r61664882","pull_request_url":"https://api.github.com/repos/Homebrew/brew/pulls/162","_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments/61664882"},"html":{"href":"https://github.com/Homebrew/brew/pull/162#discussion_r61664882"},"pull_request":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/162"}}},"pull_request":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/162","id":68125915,"html_url":"https://github.com/Homebrew/brew/pull/162","diff_url":"https://github.com/Homebrew/brew/pull/162.diff","patch_url":"https://github.com/Homebrew/brew/pull/162.patch","issue_url":"https://api.github.com/repos/Homebrew/brew/issues/162","number":162,"state":"open","locked":false,"title":"Analytics: Relocate UUID to homebrew.analyticsuuid in .git/config","user":{"login":"zmwangx","id":4149852,"avatar_url":"https://avatars.githubusercontent.com/u/4149852?v=3","gravatar_id":"","url":"https://api.github.com/users/zmwangx","html_url":"https://github.com/zmwangx","followers_url":"https://api.github.com/users/zmwangx/followers","following_url":"https://api.github.com/users/zmwangx/following{/other_user}","gists_url":"https://api.github.com/users/zmwangx/gists{/gist_id}","starred_url":"https://api.github.com/users/zmwangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmwangx/subscriptions","organizations_url":"https://api.github.com/users/zmwangx/orgs","repos_url":"https://api.github.com/users/zmwangx/repos","events_url":"https://api.github.com/users/zmwangx/events{/privacy}","received_events_url":"https://api.github.com/users/zmwangx/received_events","type":"User","site_admin":false},"body":"- [x] Have you followed the guidelines in our [Contributing](https://github.com/Homebrew/brew/blob/master/.github/CONTRIBUTING.md) document?\r\n- [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/Homebrew/brew/pulls) for the same change?\r\n- [x] Have you added an explanation of what your changes do and why you'd like us to include them?\r\n- [x] N/A. Have you written new tests for your changes? [Here's an example](https://github.com/Homebrew/homebrew/pull/49031).\r\n- [x] Have you successfully ran `brew tests` with your changes locally?\r\n\r\nDiscussions in #145.\r\n\r\nThis way analytics related settings and parameters (currently `analyticsdisabled`, `analyticsmessage` and `analyticsuuid`) are all kept in the same place.\r\n\r\nNote that in this commit we offer a path of migration: if `~/.homebrew_analytics_user_uuid` already exists, read the UUID from it, write to `homebrew.analyticsuuid`, and remove it.","created_at":"2016-04-27T21:13:10Z","updated_at":"2016-04-30T04:41:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5003232df82073b359061d81f64ee44bca30e6a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Homebrew/brew/pulls/162/commits","review_comments_url":"https://api.github.com/repos/Homebrew/brew/pulls/162/comments","review_comment_url":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Homebrew/brew/issues/162/comments","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/baa44b2f19b822b38c0633960f1be8154b61967a","head":{"label":"zmwangx:analytics-relocate-uuid","ref":"analytics-relocate-uuid","sha":"baa44b2f19b822b38c0633960f1be8154b61967a","user":{"login":"zmwangx","id":4149852,"avatar_url":"https://avatars.githubusercontent.com/u/4149852?v=3","gravatar_id":"","url":"https://api.github.com/users/zmwangx","html_url":"https://github.com/zmwangx","followers_url":"https://api.github.com/users/zmwangx/followers","following_url":"https://api.github.com/users/zmwangx/following{/other_user}","gists_url":"https://api.github.com/users/zmwangx/gists{/gist_id}","starred_url":"https://api.github.com/users/zmwangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmwangx/subscriptions","organizations_url":"https://api.github.com/users/zmwangx/orgs","repos_url":"https://api.github.com/users/zmwangx/repos","events_url":"https://api.github.com/users/zmwangx/events{/privacy}","received_events_url":"https://api.github.com/users/zmwangx/received_events","type":"User","site_admin":false},"repo":{"id":57247719,"name":"brew","full_name":"zmwangx/brew","owner":{"login":"zmwangx","id":4149852,"avatar_url":"https://avatars.githubusercontent.com/u/4149852?v=3","gravatar_id":"","url":"https://api.github.com/users/zmwangx","html_url":"https://github.com/zmwangx","followers_url":"https://api.github.com/users/zmwangx/followers","following_url":"https://api.github.com/users/zmwangx/following{/other_user}","gists_url":"https://api.github.com/users/zmwangx/gists{/gist_id}","starred_url":"https://api.github.com/users/zmwangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmwangx/subscriptions","organizations_url":"https://api.github.com/users/zmwangx/orgs","repos_url":"https://api.github.com/users/zmwangx/repos","events_url":"https://api.github.com/users/zmwangx/events{/privacy}","received_events_url":"https://api.github.com/users/zmwangx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zmwangx/brew","description":":beer: The missing package manager for OS X","fork":true,"url":"https://api.github.com/repos/zmwangx/brew","forks_url":"https://api.github.com/repos/zmwangx/brew/forks","keys_url":"https://api.github.com/repos/zmwangx/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zmwangx/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zmwangx/brew/teams","hooks_url":"https://api.github.com/repos/zmwangx/brew/hooks","issue_events_url":"https://api.github.com/repos/zmwangx/brew/issues/events{/number}","events_url":"https://api.github.com/repos/zmwangx/brew/events","assignees_url":"https://api.github.com/repos/zmwangx/brew/assignees{/user}","branches_url":"https://api.github.com/repos/zmwangx/brew/branches{/branch}","tags_url":"https://api.github.com/repos/zmwangx/brew/tags","blobs_url":"https://api.github.com/repos/zmwangx/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zmwangx/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zmwangx/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/zmwangx/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zmwangx/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/zmwangx/brew/languages","stargazers_url":"https://api.github.com/repos/zmwangx/brew/stargazers","contributors_url":"https://api.github.com/repos/zmwangx/brew/contributors","subscribers_url":"https://api.github.com/repos/zmwangx/brew/subscribers","subscription_url":"https://api.github.com/repos/zmwangx/brew/subscription","commits_url":"https://api.github.com/repos/zmwangx/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/zmwangx/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/zmwangx/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/zmwangx/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/zmwangx/brew/contents/{+path}","compare_url":"https://api.github.com/repos/zmwangx/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zmwangx/brew/merges","archive_url":"https://api.github.com/repos/zmwangx/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zmwangx/brew/downloads","issues_url":"https://api.github.com/repos/zmwangx/brew/issues{/number}","pulls_url":"https://api.github.com/repos/zmwangx/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/zmwangx/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/zmwangx/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zmwangx/brew/labels{/name}","releases_url":"https://api.github.com/repos/zmwangx/brew/releases{/id}","deployments_url":"https://api.github.com/repos/zmwangx/brew/deployments","created_at":"2016-04-27T21:06:49Z","updated_at":"2016-04-27T21:06:51Z","pushed_at":"2016-04-30T01:42:17Z","git_url":"git://github.com/zmwangx/brew.git","ssh_url":"git@github.com:zmwangx/brew.git","clone_url":"https://github.com/zmwangx/brew.git","svn_url":"https://github.com/zmwangx/brew","homepage":"http://brew.sh","size":11500,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Homebrew:master","ref":"master","sha":"b0d906f0f8d90c08b0b799d5cf0fd18bf78c30da","user":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"repo":{"id":53238813,"name":"brew","full_name":"Homebrew/brew","owner":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Homebrew/brew","description":":beer: The missing package manager for OS X","fork":false,"url":"https://api.github.com/repos/Homebrew/brew","forks_url":"https://api.github.com/repos/Homebrew/brew/forks","keys_url":"https://api.github.com/repos/Homebrew/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Homebrew/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Homebrew/brew/teams","hooks_url":"https://api.github.com/repos/Homebrew/brew/hooks","issue_events_url":"https://api.github.com/repos/Homebrew/brew/issues/events{/number}","events_url":"https://api.github.com/repos/Homebrew/brew/events","assignees_url":"https://api.github.com/repos/Homebrew/brew/assignees{/user}","branches_url":"https://api.github.com/repos/Homebrew/brew/branches{/branch}","tags_url":"https://api.github.com/repos/Homebrew/brew/tags","blobs_url":"https://api.github.com/repos/Homebrew/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Homebrew/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Homebrew/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/Homebrew/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/Homebrew/brew/languages","stargazers_url":"https://api.github.com/repos/Homebrew/brew/stargazers","contributors_url":"https://api.github.com/repos/Homebrew/brew/contributors","subscribers_url":"https://api.github.com/repos/Homebrew/brew/subscribers","subscription_url":"https://api.github.com/repos/Homebrew/brew/subscription","commits_url":"https://api.github.com/repos/Homebrew/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/Homebrew/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/Homebrew/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/Homebrew/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/Homebrew/brew/contents/{+path}","compare_url":"https://api.github.com/repos/Homebrew/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Homebrew/brew/merges","archive_url":"https://api.github.com/repos/Homebrew/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Homebrew/brew/downloads","issues_url":"https://api.github.com/repos/Homebrew/brew/issues{/number}","pulls_url":"https://api.github.com/repos/Homebrew/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/Homebrew/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/Homebrew/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Homebrew/brew/labels{/name}","releases_url":"https://api.github.com/repos/Homebrew/brew/releases{/id}","deployments_url":"https://api.github.com/repos/Homebrew/brew/deployments","created_at":"2016-03-06T05:08:38Z","updated_at":"2016-04-30T04:21:28Z","pushed_at":"2016-04-30T01:42:18Z","git_url":"git://github.com/Homebrew/brew.git","ssh_url":"git@github.com:Homebrew/brew.git","clone_url":"https://github.com/Homebrew/brew.git","svn_url":"https://github.com/Homebrew/brew","homepage":"http://brew.sh","size":11632,"stargazers_count":782,"watchers_count":782,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":184,"mirror_url":null,"open_issues_count":36,"forks":184,"open_issues":36,"watchers":782,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/162"},"html":{"href":"https://github.com/Homebrew/brew/pull/162"},"issue":{"href":"https://api.github.com/repos/Homebrew/brew/issues/162"},"comments":{"href":"https://api.github.com/repos/Homebrew/brew/issues/162/comments"},"review_comments":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/162/comments"},"review_comment":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/162/commits"},"statuses":{"href":"https://api.github.com/repos/Homebrew/brew/statuses/baa44b2f19b822b38c0633960f1be8154b61967a"}}}}