{"action":"created","comment":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments/40512012","id":40512012,"diff_hunk":"@@ -39,16 +39,48 @@ def validate!\n         def run\n           prefix = @shallow ? 'Creating shallow clone of' : 'Cloning'\n           UI.section(\"#{prefix} spec repo `#{@name}` from `#{@url}`#{\" (branch `#{@branch}`)\" if @branch}\") do\n-            config.repos_dir.mkpath\n-            Dir.chdir(config.repos_dir) do\n-              command = ['clone', @url, @name]\n-              command << '--depth=1' if @shallow\n-              git!(command)\n-            end\n-            Dir.chdir(dir) { git!('checkout', @branch) } if @branch\n+            create_repos_dir\n+            clone_repo\n+            checkout_branch\n             SourcesManager.check_version_information(dir)\n           end\n         end\n+\n+        private\n+\n+        # Creates the repos directory specified in the configuration by\n+        # `config.repos_dir`.\n+        #\n+        # @return [void]\n+        #\n+        # @raise  If the directory cannot be created due to a system error.\n+        #\n+        def create_repos_dir\n+          config.repos_dir.mkpath\n+        rescue SystemCallError => e\n+          raise Informative, \"Could not create repos directory '#{config.repos_dir}'.\\n#{e.class.name}: #{e.message}\"","path":"lib/cocoapods/command/repo/add.rb","position":30,"original_position":30,"commit_id":"8711a3fa948df99ab876aca2d18bd988b6e83132","original_commit_id":"8711a3fa948df99ab876aca2d18bd988b6e83132","user":{"login":"sguillope","id":2593278,"avatar_url":"https://avatars.githubusercontent.com/u/2593278?v=3","gravatar_id":"","url":"https://api.github.com/users/sguillope","html_url":"https://github.com/sguillope","followers_url":"https://api.github.com/users/sguillope/followers","following_url":"https://api.github.com/users/sguillope/following{/other_user}","gists_url":"https://api.github.com/users/sguillope/gists{/gist_id}","starred_url":"https://api.github.com/users/sguillope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguillope/subscriptions","organizations_url":"https://api.github.com/users/sguillope/orgs","repos_url":"https://api.github.com/users/sguillope/repos","events_url":"https://api.github.com/users/sguillope/events{/privacy}","received_events_url":"https://api.github.com/users/sguillope/received_events","type":"User","site_admin":false},"body":"The real change is here. The rest of the changes is only refactoring.","created_at":"2015-09-28T00:11:27Z","updated_at":"2015-09-28T00:11:27Z","html_url":"https://github.com/CocoaPods/CocoaPods/pull/4273#discussion_r40512012","pull_request_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273","_links":{"self":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments/40512012"},"html":{"href":"https://github.com/CocoaPods/CocoaPods/pull/4273#discussion_r40512012"},"pull_request":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273"}}},"pull_request":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273","id":46112285,"html_url":"https://github.com/CocoaPods/CocoaPods/pull/4273","diff_url":"https://github.com/CocoaPods/CocoaPods/pull/4273.diff","patch_url":"https://github.com/CocoaPods/CocoaPods/pull/4273.patch","issue_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4273","number":4273,"state":"open","locked":false,"title":"Handle add repo mkpath exception","user":{"login":"sguillope","id":2593278,"avatar_url":"https://avatars.githubusercontent.com/u/2593278?v=3","gravatar_id":"","url":"https://api.github.com/users/sguillope","html_url":"https://github.com/sguillope","followers_url":"https://api.github.com/users/sguillope/followers","following_url":"https://api.github.com/users/sguillope/following{/other_user}","gists_url":"https://api.github.com/users/sguillope/gists{/gist_id}","starred_url":"https://api.github.com/users/sguillope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguillope/subscriptions","organizations_url":"https://api.github.com/users/sguillope/orgs","repos_url":"https://api.github.com/users/sguillope/repos","events_url":"https://api.github.com/users/sguillope/events{/privacy}","received_events_url":"https://api.github.com/users/sguillope/received_events","type":"User","site_admin":false},"body":"Hi, this is my first time at coding in Ruby but wanted to give it a shot. I apologize if this is completely off.\r\n\r\nThe issue description didn't specify what to do after handling the exception so I assumed it needed to be raised as an `Informative` (not sure what else could be done).\r\nI've also taken the liberty to do a bit of refactoring to make the main `run` method more readable.\r\n\r\nComments welcomed!\r\nThanks","created_at":"2015-09-28T00:09:34Z","updated_at":"2015-09-28T00:11:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273/commits","review_comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273/comments","review_comment_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4273/comments","statuses_url":"https://api.github.com/repos/CocoaPods/CocoaPods/statuses/8711a3fa948df99ab876aca2d18bd988b6e83132","head":{"label":"sguillope:sguillope/handle-add-repo-mkpath-exception","ref":"sguillope/handle-add-repo-mkpath-exception","sha":"8711a3fa948df99ab876aca2d18bd988b6e83132","user":{"login":"sguillope","id":2593278,"avatar_url":"https://avatars.githubusercontent.com/u/2593278?v=3","gravatar_id":"","url":"https://api.github.com/users/sguillope","html_url":"https://github.com/sguillope","followers_url":"https://api.github.com/users/sguillope/followers","following_url":"https://api.github.com/users/sguillope/following{/other_user}","gists_url":"https://api.github.com/users/sguillope/gists{/gist_id}","starred_url":"https://api.github.com/users/sguillope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguillope/subscriptions","organizations_url":"https://api.github.com/users/sguillope/orgs","repos_url":"https://api.github.com/users/sguillope/repos","events_url":"https://api.github.com/users/sguillope/events{/privacy}","received_events_url":"https://api.github.com/users/sguillope/received_events","type":"User","site_admin":false},"repo":{"id":43261137,"name":"CocoaPods","full_name":"sguillope/CocoaPods","owner":{"login":"sguillope","id":2593278,"avatar_url":"https://avatars.githubusercontent.com/u/2593278?v=3","gravatar_id":"","url":"https://api.github.com/users/sguillope","html_url":"https://github.com/sguillope","followers_url":"https://api.github.com/users/sguillope/followers","following_url":"https://api.github.com/users/sguillope/following{/other_user}","gists_url":"https://api.github.com/users/sguillope/gists{/gist_id}","starred_url":"https://api.github.com/users/sguillope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguillope/subscriptions","organizations_url":"https://api.github.com/users/sguillope/orgs","repos_url":"https://api.github.com/users/sguillope/repos","events_url":"https://api.github.com/users/sguillope/events{/privacy}","received_events_url":"https://api.github.com/users/sguillope/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sguillope/CocoaPods","description":"The Cocoa Dependency Manager.","fork":true,"url":"https://api.github.com/repos/sguillope/CocoaPods","forks_url":"https://api.github.com/repos/sguillope/CocoaPods/forks","keys_url":"https://api.github.com/repos/sguillope/CocoaPods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sguillope/CocoaPods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sguillope/CocoaPods/teams","hooks_url":"https://api.github.com/repos/sguillope/CocoaPods/hooks","issue_events_url":"https://api.github.com/repos/sguillope/CocoaPods/issues/events{/number}","events_url":"https://api.github.com/repos/sguillope/CocoaPods/events","assignees_url":"https://api.github.com/repos/sguillope/CocoaPods/assignees{/user}","branches_url":"https://api.github.com/repos/sguillope/CocoaPods/branches{/branch}","tags_url":"https://api.github.com/repos/sguillope/CocoaPods/tags","blobs_url":"https://api.github.com/repos/sguillope/CocoaPods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sguillope/CocoaPods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sguillope/CocoaPods/git/refs{/sha}","trees_url":"https://api.github.com/repos/sguillope/CocoaPods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sguillope/CocoaPods/statuses/{sha}","languages_url":"https://api.github.com/repos/sguillope/CocoaPods/languages","stargazers_url":"https://api.github.com/repos/sguillope/CocoaPods/stargazers","contributors_url":"https://api.github.com/repos/sguillope/CocoaPods/contributors","subscribers_url":"https://api.github.com/repos/sguillope/CocoaPods/subscribers","subscription_url":"https://api.github.com/repos/sguillope/CocoaPods/subscription","commits_url":"https://api.github.com/repos/sguillope/CocoaPods/commits{/sha}","git_commits_url":"https://api.github.com/repos/sguillope/CocoaPods/git/commits{/sha}","comments_url":"https://api.github.com/repos/sguillope/CocoaPods/comments{/number}","issue_comment_url":"https://api.github.com/repos/sguillope/CocoaPods/issues/comments{/number}","contents_url":"https://api.github.com/repos/sguillope/CocoaPods/contents/{+path}","compare_url":"https://api.github.com/repos/sguillope/CocoaPods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sguillope/CocoaPods/merges","archive_url":"https://api.github.com/repos/sguillope/CocoaPods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sguillope/CocoaPods/downloads","issues_url":"https://api.github.com/repos/sguillope/CocoaPods/issues{/number}","pulls_url":"https://api.github.com/repos/sguillope/CocoaPods/pulls{/number}","milestones_url":"https://api.github.com/repos/sguillope/CocoaPods/milestones{/number}","notifications_url":"https://api.github.com/repos/sguillope/CocoaPods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sguillope/CocoaPods/labels{/name}","releases_url":"https://api.github.com/repos/sguillope/CocoaPods/releases{/id}","created_at":"2015-09-27T19:23:27Z","updated_at":"2015-09-27T19:23:31Z","pushed_at":"2015-09-28T00:08:50Z","git_url":"git://github.com/sguillope/CocoaPods.git","ssh_url":"git@github.com:sguillope/CocoaPods.git","clone_url":"https://github.com/sguillope/CocoaPods.git","svn_url":"https://github.com/sguillope/CocoaPods","homepage":"cocoapods.org","size":73247,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"CocoaPods:master","ref":"master","sha":"691e3de4405a0b7174ccd9ca85912a045d286aa2","user":{"login":"CocoaPods","id":1189714,"avatar_url":"https://avatars.githubusercontent.com/u/1189714?v=3","gravatar_id":"","url":"https://api.github.com/users/CocoaPods","html_url":"https://github.com/CocoaPods","followers_url":"https://api.github.com/users/CocoaPods/followers","following_url":"https://api.github.com/users/CocoaPods/following{/other_user}","gists_url":"https://api.github.com/users/CocoaPods/gists{/gist_id}","starred_url":"https://api.github.com/users/CocoaPods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CocoaPods/subscriptions","organizations_url":"https://api.github.com/users/CocoaPods/orgs","repos_url":"https://api.github.com/users/CocoaPods/repos","events_url":"https://api.github.com/users/CocoaPods/events{/privacy}","received_events_url":"https://api.github.com/users/CocoaPods/received_events","type":"Organization","site_admin":false},"repo":{"id":2203645,"name":"CocoaPods","full_name":"CocoaPods/CocoaPods","owner":{"login":"CocoaPods","id":1189714,"avatar_url":"https://avatars.githubusercontent.com/u/1189714?v=3","gravatar_id":"","url":"https://api.github.com/users/CocoaPods","html_url":"https://github.com/CocoaPods","followers_url":"https://api.github.com/users/CocoaPods/followers","following_url":"https://api.github.com/users/CocoaPods/following{/other_user}","gists_url":"https://api.github.com/users/CocoaPods/gists{/gist_id}","starred_url":"https://api.github.com/users/CocoaPods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CocoaPods/subscriptions","organizations_url":"https://api.github.com/users/CocoaPods/orgs","repos_url":"https://api.github.com/users/CocoaPods/repos","events_url":"https://api.github.com/users/CocoaPods/events{/privacy}","received_events_url":"https://api.github.com/users/CocoaPods/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CocoaPods/CocoaPods","description":"The Cocoa Dependency Manager.","fork":false,"url":"https://api.github.com/repos/CocoaPods/CocoaPods","forks_url":"https://api.github.com/repos/CocoaPods/CocoaPods/forks","keys_url":"https://api.github.com/repos/CocoaPods/CocoaPods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CocoaPods/CocoaPods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CocoaPods/CocoaPods/teams","hooks_url":"https://api.github.com/repos/CocoaPods/CocoaPods/hooks","issue_events_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/events{/number}","events_url":"https://api.github.com/repos/CocoaPods/CocoaPods/events","assignees_url":"https://api.github.com/repos/CocoaPods/CocoaPods/assignees{/user}","branches_url":"https://api.github.com/repos/CocoaPods/CocoaPods/branches{/branch}","tags_url":"https://api.github.com/repos/CocoaPods/CocoaPods/tags","blobs_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/refs{/sha}","trees_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CocoaPods/CocoaPods/statuses/{sha}","languages_url":"https://api.github.com/repos/CocoaPods/CocoaPods/languages","stargazers_url":"https://api.github.com/repos/CocoaPods/CocoaPods/stargazers","contributors_url":"https://api.github.com/repos/CocoaPods/CocoaPods/contributors","subscribers_url":"https://api.github.com/repos/CocoaPods/CocoaPods/subscribers","subscription_url":"https://api.github.com/repos/CocoaPods/CocoaPods/subscription","commits_url":"https://api.github.com/repos/CocoaPods/CocoaPods/commits{/sha}","git_commits_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/commits{/sha}","comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/comments{/number}","issue_comment_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/comments{/number}","contents_url":"https://api.github.com/repos/CocoaPods/CocoaPods/contents/{+path}","compare_url":"https://api.github.com/repos/CocoaPods/CocoaPods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CocoaPods/CocoaPods/merges","archive_url":"https://api.github.com/repos/CocoaPods/CocoaPods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CocoaPods/CocoaPods/downloads","issues_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues{/number}","pulls_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls{/number}","milestones_url":"https://api.github.com/repos/CocoaPods/CocoaPods/milestones{/number}","notifications_url":"https://api.github.com/repos/CocoaPods/CocoaPods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CocoaPods/CocoaPods/labels{/name}","releases_url":"https://api.github.com/repos/CocoaPods/CocoaPods/releases{/id}","created_at":"2011-08-14T00:10:53Z","updated_at":"2015-09-27T22:11:57Z","pushed_at":"2015-09-28T00:09:34Z","git_url":"git://github.com/CocoaPods/CocoaPods.git","ssh_url":"git@github.com:CocoaPods/CocoaPods.git","clone_url":"https://github.com/CocoaPods/CocoaPods.git","svn_url":"https://github.com/CocoaPods/CocoaPods","homepage":"https://cocoapods.org","size":73247,"stargazers_count":6411,"watchers_count":6411,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1193,"mirror_url":null,"open_issues_count":193,"forks":1193,"open_issues":193,"watchers":6411,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273"},"html":{"href":"https://github.com/CocoaPods/CocoaPods/pull/4273"},"issue":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4273"},"comments":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4273/comments"},"review_comments":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273/comments"},"review_comment":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/4273/commits"},"statuses":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/statuses/8711a3fa948df99ab876aca2d18bd988b6e83132"}}}}