{"action":"created","comment":{"url":"https://api.github.com/repos/PressLabs/gitfs/pulls/comments/54075012","id":54075012,"diff_hunk":"@@ -89,17 +94,23 @@ def checkout(self, ref, *args, **kwargs):\n                 continue\n \n             # check if file exists or not\n+            full_path = self._full_path(path)\n             if path not in self._repo.index:\n                 if path not in self.ignore:\n-                    os.unlink(self._full_path(path))\n+                    try:\n+                        os.unlink(full_path)\n+                    except OSError:\n+                        # path points to a directory containing untracked files\n+                        rmtree(full_path,\n+                               onerror=Repository.checkout_fail_rmtree_callback)","path":"gitfs/repository.py","position":32,"original_position":32,"commit_id":"734042d4860c5c25a9b5a8c372e01cc6bff50a5e","original_commit_id":"734042d4860c5c25a9b5a8c372e01cc6bff50a5e","user":{"login":"bogdanpetrea","id":8372264,"avatar_url":"https://avatars.githubusercontent.com/u/8372264?v=3","gravatar_id":"","url":"https://api.github.com/users/bogdanpetrea","html_url":"https://github.com/bogdanpetrea","followers_url":"https://api.github.com/users/bogdanpetrea/followers","following_url":"https://api.github.com/users/bogdanpetrea/following{/other_user}","gists_url":"https://api.github.com/users/bogdanpetrea/gists{/gist_id}","starred_url":"https://api.github.com/users/bogdanpetrea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogdanpetrea/subscriptions","organizations_url":"https://api.github.com/users/bogdanpetrea/orgs","repos_url":"https://api.github.com/users/bogdanpetrea/repos","events_url":"https://api.github.com/users/bogdanpetrea/events{/privacy}","received_events_url":"https://api.github.com/users/bogdanpetrea/received_events","type":"User","site_admin":false},"body":"Good idea!","created_at":"2016-02-25T10:23:03Z","updated_at":"2016-02-25T10:23:03Z","html_url":"https://github.com/PressLabs/gitfs/pull/221#discussion_r54075012","pull_request_url":"https://api.github.com/repos/PressLabs/gitfs/pulls/221","_links":{"self":{"href":"https://api.github.com/repos/PressLabs/gitfs/pulls/comments/54075012"},"html":{"href":"https://github.com/PressLabs/gitfs/pull/221#discussion_r54075012"},"pull_request":{"href":"https://api.github.com/repos/PressLabs/gitfs/pulls/221"}}},"pull_request":{"url":"https://api.github.com/repos/PressLabs/gitfs/pulls/221","id":59794601,"html_url":"https://github.com/PressLabs/gitfs/pull/221","diff_url":"https://github.com/PressLabs/gitfs/pull/221.diff","patch_url":"https://github.com/PressLabs/gitfs/pull/221.patch","issue_url":"https://api.github.com/repos/PressLabs/gitfs/issues/221","number":221,"state":"open","locked":false,"title":"Consider the case where the path points at a directory.","user":{"login":"bogdanpetrea","id":8372264,"avatar_url":"https://avatars.githubusercontent.com/u/8372264?v=3","gravatar_id":"","url":"https://api.github.com/users/bogdanpetrea","html_url":"https://github.com/bogdanpetrea","followers_url":"https://api.github.com/users/bogdanpetrea/followers","following_url":"https://api.github.com/users/bogdanpetrea/following{/other_user}","gists_url":"https://api.github.com/users/bogdanpetrea/gists{/gist_id}","starred_url":"https://api.github.com/users/bogdanpetrea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogdanpetrea/subscriptions","organizations_url":"https://api.github.com/users/bogdanpetrea/orgs","repos_url":"https://api.github.com/users/bogdanpetrea/repos","events_url":"https://api.github.com/users/bogdanpetrea/events{/privacy}","received_events_url":"https://api.github.com/users/bogdanpetrea/received_events","type":"User","site_admin":false},"body":"Fix #195","created_at":"2016-02-18T12:56:25Z","updated_at":"2016-02-25T10:23:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4812e5717fee76b5b3429fc96620215858993dfa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PressLabs/gitfs/pulls/221/commits","review_comments_url":"https://api.github.com/repos/PressLabs/gitfs/pulls/221/comments","review_comment_url":"https://api.github.com/repos/PressLabs/gitfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PressLabs/gitfs/issues/221/comments","statuses_url":"https://api.github.com/repos/PressLabs/gitfs/statuses/734042d4860c5c25a9b5a8c372e01cc6bff50a5e","head":{"label":"PressLabs:fix-checkout-delete-directory-#195","ref":"fix-checkout-delete-directory-#195","sha":"734042d4860c5c25a9b5a8c372e01cc6bff50a5e","user":{"login":"PressLabs","id":1033395,"avatar_url":"https://avatars.githubusercontent.com/u/1033395?v=3","gravatar_id":"","url":"https://api.github.com/users/PressLabs","html_url":"https://github.com/PressLabs","followers_url":"https://api.github.com/users/PressLabs/followers","following_url":"https://api.github.com/users/PressLabs/following{/other_user}","gists_url":"https://api.github.com/users/PressLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PressLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PressLabs/subscriptions","organizations_url":"https://api.github.com/users/PressLabs/orgs","repos_url":"https://api.github.com/users/PressLabs/repos","events_url":"https://api.github.com/users/PressLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PressLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":21345110,"name":"gitfs","full_name":"PressLabs/gitfs","owner":{"login":"PressLabs","id":1033395,"avatar_url":"https://avatars.githubusercontent.com/u/1033395?v=3","gravatar_id":"","url":"https://api.github.com/users/PressLabs","html_url":"https://github.com/PressLabs","followers_url":"https://api.github.com/users/PressLabs/followers","following_url":"https://api.github.com/users/PressLabs/following{/other_user}","gists_url":"https://api.github.com/users/PressLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PressLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PressLabs/subscriptions","organizations_url":"https://api.github.com/users/PressLabs/orgs","repos_url":"https://api.github.com/users/PressLabs/repos","events_url":"https://api.github.com/users/PressLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PressLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PressLabs/gitfs","description":"Version controlled file system","fork":false,"url":"https://api.github.com/repos/PressLabs/gitfs","forks_url":"https://api.github.com/repos/PressLabs/gitfs/forks","keys_url":"https://api.github.com/repos/PressLabs/gitfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PressLabs/gitfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PressLabs/gitfs/teams","hooks_url":"https://api.github.com/repos/PressLabs/gitfs/hooks","issue_events_url":"https://api.github.com/repos/PressLabs/gitfs/issues/events{/number}","events_url":"https://api.github.com/repos/PressLabs/gitfs/events","assignees_url":"https://api.github.com/repos/PressLabs/gitfs/assignees{/user}","branches_url":"https://api.github.com/repos/PressLabs/gitfs/branches{/branch}","tags_url":"https://api.github.com/repos/PressLabs/gitfs/tags","blobs_url":"https://api.github.com/repos/PressLabs/gitfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PressLabs/gitfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PressLabs/gitfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/PressLabs/gitfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PressLabs/gitfs/statuses/{sha}","languages_url":"https://api.github.com/repos/PressLabs/gitfs/languages","stargazers_url":"https://api.github.com/repos/PressLabs/gitfs/stargazers","contributors_url":"https://api.github.com/repos/PressLabs/gitfs/contributors","subscribers_url":"https://api.github.com/repos/PressLabs/gitfs/subscribers","subscription_url":"https://api.github.com/repos/PressLabs/gitfs/subscription","commits_url":"https://api.github.com/repos/PressLabs/gitfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/PressLabs/gitfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/PressLabs/gitfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/PressLabs/gitfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/PressLabs/gitfs/contents/{+path}","compare_url":"https://api.github.com/repos/PressLabs/gitfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PressLabs/gitfs/merges","archive_url":"https://api.github.com/repos/PressLabs/gitfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PressLabs/gitfs/downloads","issues_url":"https://api.github.com/repos/PressLabs/gitfs/issues{/number}","pulls_url":"https://api.github.com/repos/PressLabs/gitfs/pulls{/number}","milestones_url":"https://api.github.com/repos/PressLabs/gitfs/milestones{/number}","notifications_url":"https://api.github.com/repos/PressLabs/gitfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PressLabs/gitfs/labels{/name}","releases_url":"https://api.github.com/repos/PressLabs/gitfs/releases{/id}","deployments_url":"https://api.github.com/repos/PressLabs/gitfs/deployments","created_at":"2014-06-30T08:53:33Z","updated_at":"2016-02-24T11:49:14Z","pushed_at":"2016-02-23T15:09:38Z","git_url":"git://github.com/PressLabs/gitfs.git","ssh_url":"git@github.com:PressLabs/gitfs.git","clone_url":"https://github.com/PressLabs/gitfs.git","svn_url":"https://github.com/PressLabs/gitfs","homepage":"https://www.presslabs.com/gitfs/","size":1364,"stargazers_count":968,"watchers_count":968,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":23,"forks":53,"open_issues":23,"watchers":968,"default_branch":"master"}},"base":{"label":"PressLabs:master","ref":"master","sha":"214a5070800db97b2cd3df32dd8a01883cc73415","user":{"login":"PressLabs","id":1033395,"avatar_url":"https://avatars.githubusercontent.com/u/1033395?v=3","gravatar_id":"","url":"https://api.github.com/users/PressLabs","html_url":"https://github.com/PressLabs","followers_url":"https://api.github.com/users/PressLabs/followers","following_url":"https://api.github.com/users/PressLabs/following{/other_user}","gists_url":"https://api.github.com/users/PressLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PressLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PressLabs/subscriptions","organizations_url":"https://api.github.com/users/PressLabs/orgs","repos_url":"https://api.github.com/users/PressLabs/repos","events_url":"https://api.github.com/users/PressLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PressLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":21345110,"name":"gitfs","full_name":"PressLabs/gitfs","owner":{"login":"PressLabs","id":1033395,"avatar_url":"https://avatars.githubusercontent.com/u/1033395?v=3","gravatar_id":"","url":"https://api.github.com/users/PressLabs","html_url":"https://github.com/PressLabs","followers_url":"https://api.github.com/users/PressLabs/followers","following_url":"https://api.github.com/users/PressLabs/following{/other_user}","gists_url":"https://api.github.com/users/PressLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PressLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PressLabs/subscriptions","organizations_url":"https://api.github.com/users/PressLabs/orgs","repos_url":"https://api.github.com/users/PressLabs/repos","events_url":"https://api.github.com/users/PressLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PressLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PressLabs/gitfs","description":"Version controlled file system","fork":false,"url":"https://api.github.com/repos/PressLabs/gitfs","forks_url":"https://api.github.com/repos/PressLabs/gitfs/forks","keys_url":"https://api.github.com/repos/PressLabs/gitfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PressLabs/gitfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PressLabs/gitfs/teams","hooks_url":"https://api.github.com/repos/PressLabs/gitfs/hooks","issue_events_url":"https://api.github.com/repos/PressLabs/gitfs/issues/events{/number}","events_url":"https://api.github.com/repos/PressLabs/gitfs/events","assignees_url":"https://api.github.com/repos/PressLabs/gitfs/assignees{/user}","branches_url":"https://api.github.com/repos/PressLabs/gitfs/branches{/branch}","tags_url":"https://api.github.com/repos/PressLabs/gitfs/tags","blobs_url":"https://api.github.com/repos/PressLabs/gitfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PressLabs/gitfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PressLabs/gitfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/PressLabs/gitfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PressLabs/gitfs/statuses/{sha}","languages_url":"https://api.github.com/repos/PressLabs/gitfs/languages","stargazers_url":"https://api.github.com/repos/PressLabs/gitfs/stargazers","contributors_url":"https://api.github.com/repos/PressLabs/gitfs/contributors","subscribers_url":"https://api.github.com/repos/PressLabs/gitfs/subscribers","subscription_url":"https://api.github.com/repos/PressLabs/gitfs/subscription","commits_url":"https://api.github.com/repos/PressLabs/gitfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/PressLabs/gitfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/PressLabs/gitfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/PressLabs/gitfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/PressLabs/gitfs/contents/{+path}","compare_url":"https://api.github.com/repos/PressLabs/gitfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PressLabs/gitfs/merges","archive_url":"https://api.github.com/repos/PressLabs/gitfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PressLabs/gitfs/downloads","issues_url":"https://api.github.com/repos/PressLabs/gitfs/issues{/number}","pulls_url":"https://api.github.com/repos/PressLabs/gitfs/pulls{/number}","milestones_url":"https://api.github.com/repos/PressLabs/gitfs/milestones{/number}","notifications_url":"https://api.github.com/repos/PressLabs/gitfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PressLabs/gitfs/labels{/name}","releases_url":"https://api.github.com/repos/PressLabs/gitfs/releases{/id}","deployments_url":"https://api.github.com/repos/PressLabs/gitfs/deployments","created_at":"2014-06-30T08:53:33Z","updated_at":"2016-02-24T11:49:14Z","pushed_at":"2016-02-23T15:09:38Z","git_url":"git://github.com/PressLabs/gitfs.git","ssh_url":"git@github.com:PressLabs/gitfs.git","clone_url":"https://github.com/PressLabs/gitfs.git","svn_url":"https://github.com/PressLabs/gitfs","homepage":"https://www.presslabs.com/gitfs/","size":1364,"stargazers_count":968,"watchers_count":968,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":23,"forks":53,"open_issues":23,"watchers":968,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PressLabs/gitfs/pulls/221"},"html":{"href":"https://github.com/PressLabs/gitfs/pull/221"},"issue":{"href":"https://api.github.com/repos/PressLabs/gitfs/issues/221"},"comments":{"href":"https://api.github.com/repos/PressLabs/gitfs/issues/221/comments"},"review_comments":{"href":"https://api.github.com/repos/PressLabs/gitfs/pulls/221/comments"},"review_comment":{"href":"https://api.github.com/repos/PressLabs/gitfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PressLabs/gitfs/pulls/221/commits"},"statuses":{"href":"https://api.github.com/repos/PressLabs/gitfs/statuses/734042d4860c5c25a9b5a8c372e01cc6bff50a5e"}}}}