{"action":"created","comment":{"url":"https://api.github.com/repos/Homebrew/homebrew/pulls/comments/49900840","id":49900840,"diff_hunk":"@@ -45,5 +85,77 @@ fi\n \n export HOMEBREW_BREW_FILE\n export HOMEBREW_RUBY_PATH\n+export HOMEBREW_PREFIX\n+export HOMEBREW_REPOSITORY\n+export HOMEBREW_LIBRARY\n+export HOMEBREW_CELLAR\n+\n+if [ -n \"$HOMEBREW_OSX\" ]\n+then\n+  if [ \"$(xcode-\\select --print-path)\" = \"/\" ]\n+  then\n+    cat >&2 <<EOS\n+Your xcode-select path is currently set to '/'.\n+This causes the 'xcrun' tool to hang, and can render Homebrew unusable.\n+If you are using Xcode, you should:\n+  sudo xcode-select -switch /Applications/Xcode.app\n+Otherwise, you should:\n+  sudo rm -rf /usr/share/xcode-select\n+EOS\n+    exit 1\n+  fi\n+\n+  XCRUN_OUTPUT=\"$(/usr/bin/xcrun clang 2>&1)\"\n+  XCRUN_STATUS=\"$?\"\n+\n+  if [ \"$XCRUN_STATUS\" != \"0\" ] && [[ \"$XCRUN_OUTPUT\" =~ license ]]\n+  then\n+    cat >&2 <<EOS\n+You have not agreed to the Xcode license. Please resolve this by running:\n+  sudo xcodebuild -license\n+EOS\n+    exit 1\n+  fi\n+fi\n+\n+# Many Pathname operations use getwd when they shouldn't, and then throw\n+# odd exceptions. Reduce our support burden by showing a user-friendly error.\n+if ! [ -d \"$(pwd)\" ]\n+then\n+  echo \"The current working directory doesn't exist, cannot proceed.\"\n+  exit 1\n+fi\n+\n+for i in \"$@\"\n+do\n+  [[ \"$i\" =~ ^- ]] && continue","path":"bin/brew","position":117,"original_position":117,"commit_id":"74cd84834c1f0595f28c2c756b804ec5c5babccc","original_commit_id":"74cd84834c1f0595f28c2c756b804ec5c5babccc","user":{"login":"xu-cheng","id":3105373,"avatar_url":"https://avatars.githubusercontent.com/u/3105373?v=3","gravatar_id":"","url":"https://api.github.com/users/xu-cheng","html_url":"https://github.com/xu-cheng","followers_url":"https://api.github.com/users/xu-cheng/followers","following_url":"https://api.github.com/users/xu-cheng/following{/other_user}","gists_url":"https://api.github.com/users/xu-cheng/gists{/gist_id}","starred_url":"https://api.github.com/users/xu-cheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xu-cheng/subscriptions","organizations_url":"https://api.github.com/users/xu-cheng/orgs","repos_url":"https://api.github.com/users/xu-cheng/repos","events_url":"https://api.github.com/users/xu-cheng/events{/privacy}","received_events_url":"https://api.github.com/users/xu-cheng/received_events","type":"User","site_admin":false},"body":"Just to mention, this could cuase problem when a formula(from 3rd party or DIY) is called `update-bash`.  Or when an extrenal command starts with dash. Deep down, I would prefer it to be solved sooner if merged as it is. Leaving potential buggy code is not fun. ","created_at":"2016-01-15T20:24:21Z","updated_at":"2016-01-15T20:24:21Z","html_url":"https://github.com/Homebrew/homebrew/pull/47380#discussion_r49900840","pull_request_url":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380","_links":{"self":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/comments/49900840"},"html":{"href":"https://github.com/Homebrew/homebrew/pull/47380#discussion_r49900840"},"pull_request":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380"}}},"pull_request":{"url":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380","id":54594447,"html_url":"https://github.com/Homebrew/homebrew/pull/47380","diff_url":"https://github.com/Homebrew/homebrew/pull/47380.diff","patch_url":"https://github.com/Homebrew/homebrew/pull/47380.patch","issue_url":"https://api.github.com/repos/Homebrew/homebrew/issues/47380","number":47380,"state":"open","locked":false,"title":"brew update: get the latest version of Ruby code before calling Ruby","user":{"login":"mikemcquaid","id":125011,"avatar_url":"https://avatars.githubusercontent.com/u/125011?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemcquaid","html_url":"https://github.com/mikemcquaid","followers_url":"https://api.github.com/users/mikemcquaid/followers","following_url":"https://api.github.com/users/mikemcquaid/following{/other_user}","gists_url":"https://api.github.com/users/mikemcquaid/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemcquaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemcquaid/subscriptions","organizations_url":"https://api.github.com/users/mikemcquaid/orgs","repos_url":"https://api.github.com/users/mikemcquaid/repos","events_url":"https://api.github.com/users/mikemcquaid/events{/privacy}","received_events_url":"https://api.github.com/users/mikemcquaid/received_events","type":"User","site_admin":true},"body":"This splits `brew update` into two commands: `brew update` and `brew report`.\r\n\r\n`brew update` handles:\r\n- `git fetch` the latest version of the code (in parallel) and then `git merge` (or `git rebase`) the latest version and call `brew report`\r\n\r\n`brew report` handles:\r\n- everything involving Ruby code\r\n- reporting the actual status of what changed between the revision changes (if any)\r\n\r\nTo accomplish this we've added a basic framework to create Homebrew commands in Bash and pushed a bit of shared logic (e.g. setting `HOMEBREW_PREFIX`) into Bash to be consistent.\r\n\r\nI appreciate the tests aren't all there yet and the coverage isn't great; I did this to do a line-by-line port for now so people could validate the approach and then will work on getting decent test coverage.\r\n\r\nThis provides some speedup by running `git fetch` in parallel but will also pave the way for further speedup by using ETags to only do the `git fetch` when it's actually necessary to do so.","created_at":"2015-12-25T23:21:41Z","updated_at":"2016-01-15T20:24:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68c3ce3dc30a527b80465085559490f97fd8f526","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380/commits","review_comments_url":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380/comments","review_comment_url":"https://api.github.com/repos/Homebrew/homebrew/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Homebrew/homebrew/issues/47380/comments","statuses_url":"https://api.github.com/repos/Homebrew/homebrew/statuses/74cd84834c1f0595f28c2c756b804ec5c5babccc","head":{"label":"mikemcquaid:update-bash","ref":"update-bash","sha":"74cd84834c1f0595f28c2c756b804ec5c5babccc","user":{"login":"mikemcquaid","id":125011,"avatar_url":"https://avatars.githubusercontent.com/u/125011?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemcquaid","html_url":"https://github.com/mikemcquaid","followers_url":"https://api.github.com/users/mikemcquaid/followers","following_url":"https://api.github.com/users/mikemcquaid/following{/other_user}","gists_url":"https://api.github.com/users/mikemcquaid/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemcquaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemcquaid/subscriptions","organizations_url":"https://api.github.com/users/mikemcquaid/orgs","repos_url":"https://api.github.com/users/mikemcquaid/repos","events_url":"https://api.github.com/users/mikemcquaid/events{/privacy}","received_events_url":"https://api.github.com/users/mikemcquaid/received_events","type":"User","site_admin":true},"repo":{"id":346070,"name":"homebrew","full_name":"mikemcquaid/homebrew","owner":{"login":"mikemcquaid","id":125011,"avatar_url":"https://avatars.githubusercontent.com/u/125011?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemcquaid","html_url":"https://github.com/mikemcquaid","followers_url":"https://api.github.com/users/mikemcquaid/followers","following_url":"https://api.github.com/users/mikemcquaid/following{/other_user}","gists_url":"https://api.github.com/users/mikemcquaid/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemcquaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemcquaid/subscriptions","organizations_url":"https://api.github.com/users/mikemcquaid/orgs","repos_url":"https://api.github.com/users/mikemcquaid/repos","events_url":"https://api.github.com/users/mikemcquaid/events{/privacy}","received_events_url":"https://api.github.com/users/mikemcquaid/received_events","type":"User","site_admin":true},"private":false,"html_url":"https://github.com/mikemcquaid/homebrew","description":"Packaging system for Mac OS X 10.5 and above; heavy optimisations, no redundant packages and a bonus beer theme","fork":true,"url":"https://api.github.com/repos/mikemcquaid/homebrew","forks_url":"https://api.github.com/repos/mikemcquaid/homebrew/forks","keys_url":"https://api.github.com/repos/mikemcquaid/homebrew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikemcquaid/homebrew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikemcquaid/homebrew/teams","hooks_url":"https://api.github.com/repos/mikemcquaid/homebrew/hooks","issue_events_url":"https://api.github.com/repos/mikemcquaid/homebrew/issues/events{/number}","events_url":"https://api.github.com/repos/mikemcquaid/homebrew/events","assignees_url":"https://api.github.com/repos/mikemcquaid/homebrew/assignees{/user}","branches_url":"https://api.github.com/repos/mikemcquaid/homebrew/branches{/branch}","tags_url":"https://api.github.com/repos/mikemcquaid/homebrew/tags","blobs_url":"https://api.github.com/repos/mikemcquaid/homebrew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikemcquaid/homebrew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikemcquaid/homebrew/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikemcquaid/homebrew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikemcquaid/homebrew/statuses/{sha}","languages_url":"https://api.github.com/repos/mikemcquaid/homebrew/languages","stargazers_url":"https://api.github.com/repos/mikemcquaid/homebrew/stargazers","contributors_url":"https://api.github.com/repos/mikemcquaid/homebrew/contributors","subscribers_url":"https://api.github.com/repos/mikemcquaid/homebrew/subscribers","subscription_url":"https://api.github.com/repos/mikemcquaid/homebrew/subscription","commits_url":"https://api.github.com/repos/mikemcquaid/homebrew/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikemcquaid/homebrew/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikemcquaid/homebrew/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikemcquaid/homebrew/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikemcquaid/homebrew/contents/{+path}","compare_url":"https://api.github.com/repos/mikemcquaid/homebrew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikemcquaid/homebrew/merges","archive_url":"https://api.github.com/repos/mikemcquaid/homebrew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikemcquaid/homebrew/downloads","issues_url":"https://api.github.com/repos/mikemcquaid/homebrew/issues{/number}","pulls_url":"https://api.github.com/repos/mikemcquaid/homebrew/pulls{/number}","milestones_url":"https://api.github.com/repos/mikemcquaid/homebrew/milestones{/number}","notifications_url":"https://api.github.com/repos/mikemcquaid/homebrew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikemcquaid/homebrew/labels{/name}","releases_url":"https://api.github.com/repos/mikemcquaid/homebrew/releases{/id}","created_at":"2009-10-22T14:34:12Z","updated_at":"2015-01-15T11:22:52Z","pushed_at":"2016-01-15T18:04:07Z","git_url":"git://github.com/mikemcquaid/homebrew.git","ssh_url":"git@github.com:mikemcquaid/homebrew.git","clone_url":"https://github.com/mikemcquaid/homebrew.git","svn_url":"https://github.com/mikemcquaid/homebrew","homepage":"","size":67603,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"Homebrew:master","ref":"master","sha":"4797631de52462fe97c41c767eb07b131176e570","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":206084,"name":"homebrew","full_name":"Homebrew/homebrew","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/homebrew","description":":beer: The missing package manager for OS X.","fork":false,"url":"https://api.github.com/repos/Homebrew/homebrew","forks_url":"https://api.github.com/repos/Homebrew/homebrew/forks","keys_url":"https://api.github.com/repos/Homebrew/homebrew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Homebrew/homebrew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Homebrew/homebrew/teams","hooks_url":"https://api.github.com/repos/Homebrew/homebrew/hooks","issue_events_url":"https://api.github.com/repos/Homebrew/homebrew/issues/events{/number}","events_url":"https://api.github.com/repos/Homebrew/homebrew/events","assignees_url":"https://api.github.com/repos/Homebrew/homebrew/assignees{/user}","branches_url":"https://api.github.com/repos/Homebrew/homebrew/branches{/branch}","tags_url":"https://api.github.com/repos/Homebrew/homebrew/tags","blobs_url":"https://api.github.com/repos/Homebrew/homebrew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Homebrew/homebrew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Homebrew/homebrew/git/refs{/sha}","trees_url":"https://api.github.com/repos/Homebrew/homebrew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Homebrew/homebrew/statuses/{sha}","languages_url":"https://api.github.com/repos/Homebrew/homebrew/languages","stargazers_url":"https://api.github.com/repos/Homebrew/homebrew/stargazers","contributors_url":"https://api.github.com/repos/Homebrew/homebrew/contributors","subscribers_url":"https://api.github.com/repos/Homebrew/homebrew/subscribers","subscription_url":"https://api.github.com/repos/Homebrew/homebrew/subscription","commits_url":"https://api.github.com/repos/Homebrew/homebrew/commits{/sha}","git_commits_url":"https://api.github.com/repos/Homebrew/homebrew/git/commits{/sha}","comments_url":"https://api.github.com/repos/Homebrew/homebrew/comments{/number}","issue_comment_url":"https://api.github.com/repos/Homebrew/homebrew/issues/comments{/number}","contents_url":"https://api.github.com/repos/Homebrew/homebrew/contents/{+path}","compare_url":"https://api.github.com/repos/Homebrew/homebrew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Homebrew/homebrew/merges","archive_url":"https://api.github.com/repos/Homebrew/homebrew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Homebrew/homebrew/downloads","issues_url":"https://api.github.com/repos/Homebrew/homebrew/issues{/number}","pulls_url":"https://api.github.com/repos/Homebrew/homebrew/pulls{/number}","milestones_url":"https://api.github.com/repos/Homebrew/homebrew/milestones{/number}","notifications_url":"https://api.github.com/repos/Homebrew/homebrew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Homebrew/homebrew/labels{/name}","releases_url":"https://api.github.com/repos/Homebrew/homebrew/releases{/id}","created_at":"2009-05-20T19:38:37Z","updated_at":"2016-01-15T20:02:57Z","pushed_at":"2016-01-15T20:21:25Z","git_url":"git://github.com/Homebrew/homebrew.git","ssh_url":"git@github.com:Homebrew/homebrew.git","clone_url":"https://github.com/Homebrew/homebrew.git","svn_url":"https://github.com/Homebrew/homebrew","homepage":"http://brew.sh","size":1413260,"stargazers_count":28484,"watchers_count":28484,"language":"Ruby","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":14060,"mirror_url":null,"open_issues_count":439,"forks":14060,"open_issues":439,"watchers":28484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380"},"html":{"href":"https://github.com/Homebrew/homebrew/pull/47380"},"issue":{"href":"https://api.github.com/repos/Homebrew/homebrew/issues/47380"},"comments":{"href":"https://api.github.com/repos/Homebrew/homebrew/issues/47380/comments"},"review_comments":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380/comments"},"review_comment":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/47380/commits"},"statuses":{"href":"https://api.github.com/repos/Homebrew/homebrew/statuses/74cd84834c1f0595f28c2c756b804ec5c5babccc"}}}}