{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/30461871","id":30461871,"diff_hunk":"@@ -25,25 +25,41 @@ function mkcachedir()\n     end\n end\n \n-\n function prefetch(pkg::AbstractString, url::AbstractString, sha1s::Vector)\n     isdir(\".cache\") || mkcachedir()\n     cache = path(pkg)\n-    if !isdir(cache)\n+    repo = if isdir(cache)\n+        try\n+            LibGit2.GitRepo(cache) # open repo, free it at the end\n+        catch err\n+            rethrow(err)\n+        end\n+    else\n         info(\"Cloning cache of $pkg from $url\")\n-        try Git.run(`clone -q --mirror $url $cache`)\n-        catch\n-            rm(cache, recursive=true)\n-            rethrow()\n+        try\n+            # clone repo, free it at the end\n+            LibGit2.clone(url, cache, bare = true, remote_cb = LibGit2.mirror_cb)\n+        catch err\n+            isdir(cache) && rm(cache, recursive=true)\n+            error(\"Cannot clone $pkg from $url\\n\", err)","path":"base/pkg/cache.jl","position":34,"original_position":34,"commit_id":"a032f7ff1d6212f43089a9dfe9ae4894c455639f","original_commit_id":"a032f7ff1d6212f43089a9dfe9ae4894c455639f","user":{"login":"wildart","id":38350,"avatar_url":"https://avatars.githubusercontent.com/u/38350?v=3","gravatar_id":"","url":"https://api.github.com/users/wildart","html_url":"https://github.com/wildart","followers_url":"https://api.github.com/users/wildart/followers","following_url":"https://api.github.com/users/wildart/following{/other_user}","gists_url":"https://api.github.com/users/wildart/gists{/gist_id}","starred_url":"https://api.github.com/users/wildart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildart/subscriptions","organizations_url":"https://api.github.com/users/wildart/orgs","repos_url":"https://api.github.com/users/wildart/repos","events_url":"https://api.github.com/users/wildart/events{/privacy}","received_events_url":"https://api.github.com/users/wildart/received_events","type":"User","site_admin":false},"body":"Usually, after these errors the package system interrupts and no exception handling is required. I guess  it should be done properly. I see your point.","created_at":"2015-05-16T15:19:17Z","updated_at":"2015-05-16T15:19:17Z","html_url":"https://github.com/JuliaLang/julia/pull/11196#discussion_r30461871","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/11196","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/30461871"},"html":{"href":"https://github.com/JuliaLang/julia/pull/11196#discussion_r30461871"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11196"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/11196","id":34982391,"html_url":"https://github.com/JuliaLang/julia/pull/11196","diff_url":"https://github.com/JuliaLang/julia/pull/11196.diff","patch_url":"https://github.com/JuliaLang/julia/pull/11196.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11196","number":11196,"state":"open","locked":false,"title":"WIP: Package system on libgit2","user":{"login":"wildart","id":38350,"avatar_url":"https://avatars.githubusercontent.com/u/38350?v=3","gravatar_id":"","url":"https://api.github.com/users/wildart","html_url":"https://github.com/wildart","followers_url":"https://api.github.com/users/wildart/followers","following_url":"https://api.github.com/users/wildart/following{/other_user}","gists_url":"https://api.github.com/users/wildart/gists{/gist_id}","starred_url":"https://api.github.com/users/wildart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildart/subscriptions","organizations_url":"https://api.github.com/users/wildart/orgs","repos_url":"https://api.github.com/users/wildart/repos","events_url":"https://api.github.com/users/wildart/events{/privacy}","received_events_url":"https://api.github.com/users/wildart/received_events","type":"User","site_admin":false},"body":"Package system switch to `libgit2` promises faster and resource efficient package management.\r\n\r\nThis work originated in #11143.","created_at":"2015-05-08T05:57:03Z","updated_at":"2015-05-16T15:19:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/11196/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/11196/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11196/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/a032f7ff1d6212f43089a9dfe9ae4894c455639f","head":{"label":"JuliaLang:art/pkg-libgit2","ref":"art/pkg-libgit2","sha":"a032f7ff1d6212f43089a9dfe9ae4894c455639f","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2015-05-16T14:41:34Z","pushed_at":"2015-05-16T15:10:38Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":208216,"stargazers_count":5521,"watchers_count":5521,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1157,"mirror_url":null,"open_issues_count":1280,"forks":1157,"open_issues":1280,"watchers":5521,"default_branch":"master"}},"base":{"label":"JuliaLang:master","ref":"master","sha":"5ef01ac44c09253f822c045de7d719e0d4a28283","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2015-05-16T14:41:34Z","pushed_at":"2015-05-16T15:10:38Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":208216,"stargazers_count":5521,"watchers_count":5521,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1157,"mirror_url":null,"open_issues_count":1280,"forks":1157,"open_issues":1280,"watchers":5521,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11196"},"html":{"href":"https://github.com/JuliaLang/julia/pull/11196"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/11196"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/11196/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11196/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/11196/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/a032f7ff1d6212f43089a9dfe9ae4894c455639f"}}}}