{"action":"created","comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments/85368672","pull_request_review_id":6089785,"id":85368672,"diff_hunk":"@@ -73,7 +73,17 @@ export default class GitFetcher extends BaseFetcher {\n     await git.initRemote();\n     await git.clone(this.dest);\n \n-    let tarballInMirrorPath = this.config.getOfflineMirrorPath(this.reference);\n+    // Get the tarball filename from the url\n+    const {pathname} = url.parse(this.reference);\n+    let tarballFilename;\n+    if (pathname == null) {\n+      tarballFilename = this.reference;\n+    } else {\n+      tarballFilename = path.basename(pathname);\n+    }\n+\n+    let tarballInMirrorPath = this.config.getOfflineMirrorPath(tarballFilename);","path":"src/fetchers/git-fetcher.js","position":14,"original_position":14,"commit_id":"931c14f273db44678e36d90204b3d2a2b15eba5b","original_commit_id":"6e5c50308257068dc12c71207ba95a8146174954","user":{"login":"ide","id":379606,"avatar_url":"https://avatars.githubusercontent.com/u/379606?v=3","gravatar_id":"","url":"https://api.github.com/users/ide","html_url":"https://github.com/ide","followers_url":"https://api.github.com/users/ide/followers","following_url":"https://api.github.com/users/ide/following{/other_user}","gists_url":"https://api.github.com/users/ide/gists{/gist_id}","starred_url":"https://api.github.com/users/ide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ide/subscriptions","organizations_url":"https://api.github.com/users/ide/orgs","repos_url":"https://api.github.com/users/ide/repos","events_url":"https://api.github.com/users/ide/events{/privacy}","received_events_url":"https://api.github.com/users/ide/received_events","type":"User","site_admin":false},"body":"@bestander I'm not sure if a non-breaking approach is possible without adding a lot of special logic for backwards compatibility, but this could be OK. My understanding is that the breaking change affects only people who use an offline mirror and have a project that depends on a scoped package. Some of those people also have buggy lockfiles that sometimes trigger \"bad hash\" errors. After this PR they will get just one more \"bad hash\" error that will go away after they regenerate the lockfile.","created_at":"2016-10-27T15:55:09Z","updated_at":"2016-10-27T15:55:09Z","html_url":"https://github.com/yarnpkg/yarn/pull/784#discussion_r85368672","pull_request_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/784","_links":{"self":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments/85368672"},"html":{"href":"https://github.com/yarnpkg/yarn/pull/784#discussion_r85368672"},"pull_request":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/784"}}},"pull_request":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/784","id":88942463,"html_url":"https://github.com/yarnpkg/yarn/pull/784","diff_url":"https://github.com/yarnpkg/yarn/pull/784.diff","patch_url":"https://github.com/yarnpkg/yarn/pull/784.patch","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/784","number":784,"state":"open","locked":false,"title":"Properly save scoped packages in offline mirror.","user":{"login":"skevy","id":131916,"avatar_url":"https://avatars.githubusercontent.com/u/131916?v=3","gravatar_id":"","url":"https://api.github.com/users/skevy","html_url":"https://github.com/skevy","followers_url":"https://api.github.com/users/skevy/followers","following_url":"https://api.github.com/users/skevy/following{/other_user}","gists_url":"https://api.github.com/users/skevy/gists{/gist_id}","starred_url":"https://api.github.com/users/skevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skevy/subscriptions","organizations_url":"https://api.github.com/users/skevy/orgs","repos_url":"https://api.github.com/users/skevy/repos","events_url":"https://api.github.com/users/skevy/events{/privacy}","received_events_url":"https://api.github.com/users/skevy/received_events","type":"User","site_admin":false},"body":"When I was converting more Exponent projects to use `yarn` this afternoon, I encountered a perplexing bug.\r\n\r\nIn this project, there were two dependencies that were installed: \"@exponent/md5hex@^1.0.0\" and \"md5hex@^1.0.0\". Also, I'm using an offline mirror with this project.\r\n\r\nWhen installing on my local machine and on my test server, things worked fine -- I didn't notice an issue. But when installing in Docker, for some reason I was getting a \"Bad hash\" error, in which it was telling me that the hash of the md5hex tar.gz file was not correct. \r\n\r\nAs it turns out, there were entries for \"@exponent/md5hex@^1.0.0\" and \"md5hex@^1.0.0\" in my lock file, both pointing to the same file in the offline cache, but with different hashes. This was the cause of the bad hash issue.\r\n\r\nThe actual bug was that Yarn was saving scoped packages in the offline mirror by their base name, which meant that if two packages in a project had the same name and version, but one of them was scoped and the other was not, only one of these would be saved in the offline mirror, and then this bad hash transient error could potentially occur.\r\n\r\nThis PR fixes this behavior, and saves scoped npm packages in the offline mirror in the form `@[scope]-[package name]-[version].tar.gz`.\r\n\r\n*Test plan:*\r\n\r\nRun tests :) \r\n\r\nI added two tests and modified one -- the two I added just verified that it saved both scoped and unscoped packages in the offline mirror with the correct name. The modified test was the \"install-from-offline-mirror\" integration test -- I simply added a scoped package (along with the correct entry in the yarn.lock file) hopefully to prevent possible regressions in the future.","created_at":"2016-10-12T02:12:22Z","updated_at":"2016-10-27T15:55:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b959105e863beda598b120302945f76e2034a3b","assignee":{"login":"kittens","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/kittens","html_url":"https://github.com/kittens","followers_url":"https://api.github.com/users/kittens/followers","following_url":"https://api.github.com/users/kittens/following{/other_user}","gists_url":"https://api.github.com/users/kittens/gists{/gist_id}","starred_url":"https://api.github.com/users/kittens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kittens/subscriptions","organizations_url":"https://api.github.com/users/kittens/orgs","repos_url":"https://api.github.com/users/kittens/repos","events_url":"https://api.github.com/users/kittens/events{/privacy}","received_events_url":"https://api.github.com/users/kittens/received_events","type":"User","site_admin":false},"assignees":[{"login":"kittens","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/kittens","html_url":"https://github.com/kittens","followers_url":"https://api.github.com/users/kittens/followers","following_url":"https://api.github.com/users/kittens/following{/other_user}","gists_url":"https://api.github.com/users/kittens/gists{/gist_id}","starred_url":"https://api.github.com/users/kittens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kittens/subscriptions","organizations_url":"https://api.github.com/users/kittens/orgs","repos_url":"https://api.github.com/users/kittens/repos","events_url":"https://api.github.com/users/kittens/events{/privacy}","received_events_url":"https://api.github.com/users/kittens/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/784/commits","review_comments_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/784/comments","review_comment_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/784/comments","statuses_url":"https://api.github.com/repos/yarnpkg/yarn/statuses/931c14f273db44678e36d90204b3d2a2b15eba5b","head":{"label":"skevy:scoped-packages-offline-mirror","ref":"scoped-packages-offline-mirror","sha":"931c14f273db44678e36d90204b3d2a2b15eba5b","user":{"login":"skevy","id":131916,"avatar_url":"https://avatars.githubusercontent.com/u/131916?v=3","gravatar_id":"","url":"https://api.github.com/users/skevy","html_url":"https://github.com/skevy","followers_url":"https://api.github.com/users/skevy/followers","following_url":"https://api.github.com/users/skevy/following{/other_user}","gists_url":"https://api.github.com/users/skevy/gists{/gist_id}","starred_url":"https://api.github.com/users/skevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skevy/subscriptions","organizations_url":"https://api.github.com/users/skevy/orgs","repos_url":"https://api.github.com/users/skevy/repos","events_url":"https://api.github.com/users/skevy/events{/privacy}","received_events_url":"https://api.github.com/users/skevy/received_events","type":"User","site_admin":false},"repo":{"id":70652700,"name":"yarn","full_name":"skevy/yarn","owner":{"login":"skevy","id":131916,"avatar_url":"https://avatars.githubusercontent.com/u/131916?v=3","gravatar_id":"","url":"https://api.github.com/users/skevy","html_url":"https://github.com/skevy","followers_url":"https://api.github.com/users/skevy/followers","following_url":"https://api.github.com/users/skevy/following{/other_user}","gists_url":"https://api.github.com/users/skevy/gists{/gist_id}","starred_url":"https://api.github.com/users/skevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skevy/subscriptions","organizations_url":"https://api.github.com/users/skevy/orgs","repos_url":"https://api.github.com/users/skevy/repos","events_url":"https://api.github.com/users/skevy/events{/privacy}","received_events_url":"https://api.github.com/users/skevy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skevy/yarn","description":"📦🐈 Fast, reliable, and secure dependency management for JavaScript.","fork":true,"url":"https://api.github.com/repos/skevy/yarn","forks_url":"https://api.github.com/repos/skevy/yarn/forks","keys_url":"https://api.github.com/repos/skevy/yarn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skevy/yarn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skevy/yarn/teams","hooks_url":"https://api.github.com/repos/skevy/yarn/hooks","issue_events_url":"https://api.github.com/repos/skevy/yarn/issues/events{/number}","events_url":"https://api.github.com/repos/skevy/yarn/events","assignees_url":"https://api.github.com/repos/skevy/yarn/assignees{/user}","branches_url":"https://api.github.com/repos/skevy/yarn/branches{/branch}","tags_url":"https://api.github.com/repos/skevy/yarn/tags","blobs_url":"https://api.github.com/repos/skevy/yarn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skevy/yarn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skevy/yarn/git/refs{/sha}","trees_url":"https://api.github.com/repos/skevy/yarn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skevy/yarn/statuses/{sha}","languages_url":"https://api.github.com/repos/skevy/yarn/languages","stargazers_url":"https://api.github.com/repos/skevy/yarn/stargazers","contributors_url":"https://api.github.com/repos/skevy/yarn/contributors","subscribers_url":"https://api.github.com/repos/skevy/yarn/subscribers","subscription_url":"https://api.github.com/repos/skevy/yarn/subscription","commits_url":"https://api.github.com/repos/skevy/yarn/commits{/sha}","git_commits_url":"https://api.github.com/repos/skevy/yarn/git/commits{/sha}","comments_url":"https://api.github.com/repos/skevy/yarn/comments{/number}","issue_comment_url":"https://api.github.com/repos/skevy/yarn/issues/comments{/number}","contents_url":"https://api.github.com/repos/skevy/yarn/contents/{+path}","compare_url":"https://api.github.com/repos/skevy/yarn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skevy/yarn/merges","archive_url":"https://api.github.com/repos/skevy/yarn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skevy/yarn/downloads","issues_url":"https://api.github.com/repos/skevy/yarn/issues{/number}","pulls_url":"https://api.github.com/repos/skevy/yarn/pulls{/number}","milestones_url":"https://api.github.com/repos/skevy/yarn/milestones{/number}","notifications_url":"https://api.github.com/repos/skevy/yarn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skevy/yarn/labels{/name}","releases_url":"https://api.github.com/repos/skevy/yarn/releases{/id}","deployments_url":"https://api.github.com/repos/skevy/yarn/deployments","created_at":"2016-10-12T02:02:32Z","updated_at":"2016-10-12T02:03:06Z","pushed_at":"2016-10-19T15:03:29Z","git_url":"git://github.com/skevy/yarn.git","ssh_url":"git@github.com:skevy/yarn.git","clone_url":"https://github.com/skevy/yarn.git","svn_url":"https://github.com/skevy/yarn","homepage":"https://yarnpkg.com","size":41356,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"yarnpkg:master","ref":"master","sha":"a9580f8faad9bdeb62ece89b192b979f280a9099","user":{"login":"yarnpkg","id":22247014,"avatar_url":"https://avatars.githubusercontent.com/u/22247014?v=3","gravatar_id":"","url":"https://api.github.com/users/yarnpkg","html_url":"https://github.com/yarnpkg","followers_url":"https://api.github.com/users/yarnpkg/followers","following_url":"https://api.github.com/users/yarnpkg/following{/other_user}","gists_url":"https://api.github.com/users/yarnpkg/gists{/gist_id}","starred_url":"https://api.github.com/users/yarnpkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarnpkg/subscriptions","organizations_url":"https://api.github.com/users/yarnpkg/orgs","repos_url":"https://api.github.com/users/yarnpkg/repos","events_url":"https://api.github.com/users/yarnpkg/events{/privacy}","received_events_url":"https://api.github.com/users/yarnpkg/received_events","type":"Organization","site_admin":false},"repo":{"id":49970642,"name":"yarn","full_name":"yarnpkg/yarn","owner":{"login":"yarnpkg","id":22247014,"avatar_url":"https://avatars.githubusercontent.com/u/22247014?v=3","gravatar_id":"","url":"https://api.github.com/users/yarnpkg","html_url":"https://github.com/yarnpkg","followers_url":"https://api.github.com/users/yarnpkg/followers","following_url":"https://api.github.com/users/yarnpkg/following{/other_user}","gists_url":"https://api.github.com/users/yarnpkg/gists{/gist_id}","starred_url":"https://api.github.com/users/yarnpkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarnpkg/subscriptions","organizations_url":"https://api.github.com/users/yarnpkg/orgs","repos_url":"https://api.github.com/users/yarnpkg/repos","events_url":"https://api.github.com/users/yarnpkg/events{/privacy}","received_events_url":"https://api.github.com/users/yarnpkg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarnpkg/yarn","description":"📦🐈 Fast, reliable, and secure dependency management.","fork":false,"url":"https://api.github.com/repos/yarnpkg/yarn","forks_url":"https://api.github.com/repos/yarnpkg/yarn/forks","keys_url":"https://api.github.com/repos/yarnpkg/yarn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarnpkg/yarn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarnpkg/yarn/teams","hooks_url":"https://api.github.com/repos/yarnpkg/yarn/hooks","issue_events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/events{/number}","events_url":"https://api.github.com/repos/yarnpkg/yarn/events","assignees_url":"https://api.github.com/repos/yarnpkg/yarn/assignees{/user}","branches_url":"https://api.github.com/repos/yarnpkg/yarn/branches{/branch}","tags_url":"https://api.github.com/repos/yarnpkg/yarn/tags","blobs_url":"https://api.github.com/repos/yarnpkg/yarn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarnpkg/yarn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarnpkg/yarn/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarnpkg/yarn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarnpkg/yarn/statuses/{sha}","languages_url":"https://api.github.com/repos/yarnpkg/yarn/languages","stargazers_url":"https://api.github.com/repos/yarnpkg/yarn/stargazers","contributors_url":"https://api.github.com/repos/yarnpkg/yarn/contributors","subscribers_url":"https://api.github.com/repos/yarnpkg/yarn/subscribers","subscription_url":"https://api.github.com/repos/yarnpkg/yarn/subscription","commits_url":"https://api.github.com/repos/yarnpkg/yarn/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarnpkg/yarn/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarnpkg/yarn/contents/{+path}","compare_url":"https://api.github.com/repos/yarnpkg/yarn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarnpkg/yarn/merges","archive_url":"https://api.github.com/repos/yarnpkg/yarn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarnpkg/yarn/downloads","issues_url":"https://api.github.com/repos/yarnpkg/yarn/issues{/number}","pulls_url":"https://api.github.com/repos/yarnpkg/yarn/pulls{/number}","milestones_url":"https://api.github.com/repos/yarnpkg/yarn/milestones{/number}","notifications_url":"https://api.github.com/repos/yarnpkg/yarn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarnpkg/yarn/labels{/name}","releases_url":"https://api.github.com/repos/yarnpkg/yarn/releases{/id}","deployments_url":"https://api.github.com/repos/yarnpkg/yarn/deployments","created_at":"2016-01-19T17:39:16Z","updated_at":"2016-10-27T15:54:42Z","pushed_at":"2016-10-27T15:36:54Z","git_url":"git://github.com/yarnpkg/yarn.git","ssh_url":"git@github.com:yarnpkg/yarn.git","clone_url":"https://github.com/yarnpkg/yarn.git","svn_url":"https://github.com/yarnpkg/yarn","homepage":"https://yarnpkg.com","size":51761,"stargazers_count":17575,"watchers_count":17575,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":537,"mirror_url":null,"open_issues_count":390,"forks":537,"open_issues":390,"watchers":17575,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/784"},"html":{"href":"https://github.com/yarnpkg/yarn/pull/784"},"issue":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/784"},"comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/784/comments"},"review_comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/784/comments"},"review_comment":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/784/commits"},"statuses":{"href":"https://api.github.com/repos/yarnpkg/yarn/statuses/931c14f273db44678e36d90204b3d2a2b15eba5b"}}}}
{"actor":{"display_login":"ide"}}