{"action":"created","comment":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/54855520","id":54855520,"diff_hunk":"@@ -51,6 +58,34 @@ public function __construct(\n      */\n     public function store(\\SplFileInfo $localFile, $destFsAlias, $deleteRawFile = false)\n     {\n+        $file = $this->findCopy($localFile);\n+\n+        if (is_null($file)) {\n+            $file = $this->saveFile($localFile, $destFsAlias);\n+        }\n+\n+        if (true === $deleteRawFile) {\n+            $this->deleteRawFile($localFile);\n+        }\n+\n+        return $file;\n+    }\n+\n+    /**\n+     * @param \\SplFileInfo $file\n+     */\n+    public function findCopy(\\SplFileInfo $localFile)\n+    {\n+        $hash = sha1_file($localFile->getPathname());\n+        return $this->repository->findOneByHash($hash);\n+    }\n+\n+    /**\n+     * @param \\SplFileInfo $file\n+     * @param string $destFsAlias\n+     */\n+    public function saveFile(\\SplFileInfo $localFile, $destFsAlias)","path":"src/Akeneo/Component/FileStorage/File/FileStorer.php","position":65,"original_position":65,"commit_id":"a9c2fa680ede1a1f976d3c0dd9fb366f45b02410","original_commit_id":"a9c2fa680ede1a1f976d3c0dd9fb366f45b02410","user":{"login":"phaseinducer","id":659491,"avatar_url":"https://avatars.githubusercontent.com/u/659491?v=3","gravatar_id":"","url":"https://api.github.com/users/phaseinducer","html_url":"https://github.com/phaseinducer","followers_url":"https://api.github.com/users/phaseinducer/followers","following_url":"https://api.github.com/users/phaseinducer/following{/other_user}","gists_url":"https://api.github.com/users/phaseinducer/gists{/gist_id}","starred_url":"https://api.github.com/users/phaseinducer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phaseinducer/subscriptions","organizations_url":"https://api.github.com/users/phaseinducer/orgs","repos_url":"https://api.github.com/users/phaseinducer/repos","events_url":"https://api.github.com/users/phaseinducer/events{/privacy}","received_events_url":"https://api.github.com/users/phaseinducer/received_events","type":"User","site_admin":false},"body":"idem, protected","created_at":"2016-03-03T09:37:27Z","updated_at":"2016-03-03T09:37:27Z","html_url":"https://github.com/akeneo/pim-community-dev/pull/4083#discussion_r54855520","pull_request_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083","_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/54855520"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/4083#discussion_r54855520"},"pull_request":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083"}}},"pull_request":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083","id":61494634,"html_url":"https://github.com/akeneo/pim-community-dev/pull/4083","diff_url":"https://github.com/akeneo/pim-community-dev/pull/4083.diff","patch_url":"https://github.com/akeneo/pim-community-dev/pull/4083.patch","issue_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4083","number":4083,"state":"open","locked":false,"title":"don't save copies FileInfo","user":{"login":"userz58","id":2612186,"avatar_url":"https://avatars.githubusercontent.com/u/2612186?v=3","gravatar_id":"","url":"https://api.github.com/users/userz58","html_url":"https://github.com/userz58","followers_url":"https://api.github.com/users/userz58/followers","following_url":"https://api.github.com/users/userz58/following{/other_user}","gists_url":"https://api.github.com/users/userz58/gists{/gist_id}","starred_url":"https://api.github.com/users/userz58/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/userz58/subscriptions","organizations_url":"https://api.github.com/users/userz58/orgs","repos_url":"https://api.github.com/users/userz58/repos","events_url":"https://api.github.com/users/userz58/events{/privacy}","received_events_url":"https://api.github.com/users/userz58/received_events","type":"User","site_admin":false},"body":"use hash column to find previously uploaded files.","created_at":"2016-03-03T00:59:50Z","updated_at":"2016-03-03T09:37:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c172e4271bd0c8d05c31be9b923984fa11150bb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083/commits","review_comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083/comments","review_comment_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4083/comments","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/a9c2fa680ede1a1f976d3c0dd9fb366f45b02410","head":{"label":"userz58:fileinfo-copy","ref":"fileinfo-copy","sha":"a9c2fa680ede1a1f976d3c0dd9fb366f45b02410","user":{"login":"userz58","id":2612186,"avatar_url":"https://avatars.githubusercontent.com/u/2612186?v=3","gravatar_id":"","url":"https://api.github.com/users/userz58","html_url":"https://github.com/userz58","followers_url":"https://api.github.com/users/userz58/followers","following_url":"https://api.github.com/users/userz58/following{/other_user}","gists_url":"https://api.github.com/users/userz58/gists{/gist_id}","starred_url":"https://api.github.com/users/userz58/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/userz58/subscriptions","organizations_url":"https://api.github.com/users/userz58/orgs","repos_url":"https://api.github.com/users/userz58/repos","events_url":"https://api.github.com/users/userz58/events{/privacy}","received_events_url":"https://api.github.com/users/userz58/received_events","type":"User","site_admin":false},"repo":{"id":51413282,"name":"pim-community-dev","full_name":"userz58/pim-community-dev","owner":{"login":"userz58","id":2612186,"avatar_url":"https://avatars.githubusercontent.com/u/2612186?v=3","gravatar_id":"","url":"https://api.github.com/users/userz58","html_url":"https://github.com/userz58","followers_url":"https://api.github.com/users/userz58/followers","following_url":"https://api.github.com/users/userz58/following{/other_user}","gists_url":"https://api.github.com/users/userz58/gists{/gist_id}","starred_url":"https://api.github.com/users/userz58/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/userz58/subscriptions","organizations_url":"https://api.github.com/users/userz58/orgs","repos_url":"https://api.github.com/users/userz58/repos","events_url":"https://api.github.com/users/userz58/events{/privacy}","received_events_url":"https://api.github.com/users/userz58/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/userz58/pim-community-dev","description":"[Community Development Repository] The open source Product Information Management (PIM)","fork":true,"url":"https://api.github.com/repos/userz58/pim-community-dev","forks_url":"https://api.github.com/repos/userz58/pim-community-dev/forks","keys_url":"https://api.github.com/repos/userz58/pim-community-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/userz58/pim-community-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/userz58/pim-community-dev/teams","hooks_url":"https://api.github.com/repos/userz58/pim-community-dev/hooks","issue_events_url":"https://api.github.com/repos/userz58/pim-community-dev/issues/events{/number}","events_url":"https://api.github.com/repos/userz58/pim-community-dev/events","assignees_url":"https://api.github.com/repos/userz58/pim-community-dev/assignees{/user}","branches_url":"https://api.github.com/repos/userz58/pim-community-dev/branches{/branch}","tags_url":"https://api.github.com/repos/userz58/pim-community-dev/tags","blobs_url":"https://api.github.com/repos/userz58/pim-community-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/userz58/pim-community-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/userz58/pim-community-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/userz58/pim-community-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/userz58/pim-community-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/userz58/pim-community-dev/languages","stargazers_url":"https://api.github.com/repos/userz58/pim-community-dev/stargazers","contributors_url":"https://api.github.com/repos/userz58/pim-community-dev/contributors","subscribers_url":"https://api.github.com/repos/userz58/pim-community-dev/subscribers","subscription_url":"https://api.github.com/repos/userz58/pim-community-dev/subscription","commits_url":"https://api.github.com/repos/userz58/pim-community-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/userz58/pim-community-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/userz58/pim-community-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/userz58/pim-community-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/userz58/pim-community-dev/contents/{+path}","compare_url":"https://api.github.com/repos/userz58/pim-community-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/userz58/pim-community-dev/merges","archive_url":"https://api.github.com/repos/userz58/pim-community-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/userz58/pim-community-dev/downloads","issues_url":"https://api.github.com/repos/userz58/pim-community-dev/issues{/number}","pulls_url":"https://api.github.com/repos/userz58/pim-community-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/userz58/pim-community-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/userz58/pim-community-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/userz58/pim-community-dev/labels{/name}","releases_url":"https://api.github.com/repos/userz58/pim-community-dev/releases{/id}","deployments_url":"https://api.github.com/repos/userz58/pim-community-dev/deployments","created_at":"2016-02-10T01:07:06Z","updated_at":"2016-02-10T01:07:17Z","pushed_at":"2016-03-03T00:57:29Z","git_url":"git://github.com/userz58/pim-community-dev.git","ssh_url":"git@github.com:userz58/pim-community-dev.git","clone_url":"https://github.com/userz58/pim-community-dev.git","svn_url":"https://github.com/userz58/pim-community-dev","homepage":"http://www.akeneo.com","size":100102,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"akeneo:master","ref":"master","sha":"bebd1a9ba9b32626446fd9be488b73e1f674e496","user":{"login":"akeneo","id":2510186,"avatar_url":"https://avatars.githubusercontent.com/u/2510186?v=3","gravatar_id":"","url":"https://api.github.com/users/akeneo","html_url":"https://github.com/akeneo","followers_url":"https://api.github.com/users/akeneo/followers","following_url":"https://api.github.com/users/akeneo/following{/other_user}","gists_url":"https://api.github.com/users/akeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/akeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akeneo/subscriptions","organizations_url":"https://api.github.com/users/akeneo/orgs","repos_url":"https://api.github.com/users/akeneo/repos","events_url":"https://api.github.com/users/akeneo/events{/privacy}","received_events_url":"https://api.github.com/users/akeneo/received_events","type":"Organization","site_admin":false},"repo":{"id":5367323,"name":"pim-community-dev","full_name":"akeneo/pim-community-dev","owner":{"login":"akeneo","id":2510186,"avatar_url":"https://avatars.githubusercontent.com/u/2510186?v=3","gravatar_id":"","url":"https://api.github.com/users/akeneo","html_url":"https://github.com/akeneo","followers_url":"https://api.github.com/users/akeneo/followers","following_url":"https://api.github.com/users/akeneo/following{/other_user}","gists_url":"https://api.github.com/users/akeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/akeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akeneo/subscriptions","organizations_url":"https://api.github.com/users/akeneo/orgs","repos_url":"https://api.github.com/users/akeneo/repos","events_url":"https://api.github.com/users/akeneo/events{/privacy}","received_events_url":"https://api.github.com/users/akeneo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akeneo/pim-community-dev","description":"[Community Development Repository] The open source Product Information Management (PIM)","fork":false,"url":"https://api.github.com/repos/akeneo/pim-community-dev","forks_url":"https://api.github.com/repos/akeneo/pim-community-dev/forks","keys_url":"https://api.github.com/repos/akeneo/pim-community-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akeneo/pim-community-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akeneo/pim-community-dev/teams","hooks_url":"https://api.github.com/repos/akeneo/pim-community-dev/hooks","issue_events_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/events{/number}","events_url":"https://api.github.com/repos/akeneo/pim-community-dev/events","assignees_url":"https://api.github.com/repos/akeneo/pim-community-dev/assignees{/user}","branches_url":"https://api.github.com/repos/akeneo/pim-community-dev/branches{/branch}","tags_url":"https://api.github.com/repos/akeneo/pim-community-dev/tags","blobs_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/akeneo/pim-community-dev/languages","stargazers_url":"https://api.github.com/repos/akeneo/pim-community-dev/stargazers","contributors_url":"https://api.github.com/repos/akeneo/pim-community-dev/contributors","subscribers_url":"https://api.github.com/repos/akeneo/pim-community-dev/subscribers","subscription_url":"https://api.github.com/repos/akeneo/pim-community-dev/subscription","commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/akeneo/pim-community-dev/contents/{+path}","compare_url":"https://api.github.com/repos/akeneo/pim-community-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akeneo/pim-community-dev/merges","archive_url":"https://api.github.com/repos/akeneo/pim-community-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akeneo/pim-community-dev/downloads","issues_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues{/number}","pulls_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/akeneo/pim-community-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/akeneo/pim-community-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akeneo/pim-community-dev/labels{/name}","releases_url":"https://api.github.com/repos/akeneo/pim-community-dev/releases{/id}","deployments_url":"https://api.github.com/repos/akeneo/pim-community-dev/deployments","created_at":"2012-08-10T09:27:26Z","updated_at":"2016-02-25T20:14:23Z","pushed_at":"2016-03-03T09:34:06Z","git_url":"git://github.com/akeneo/pim-community-dev.git","ssh_url":"git@github.com:akeneo/pim-community-dev.git","clone_url":"https://github.com/akeneo/pim-community-dev.git","svn_url":"https://github.com/akeneo/pim-community-dev","homepage":"http://www.akeneo.com","size":137184,"stargazers_count":287,"watchers_count":287,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":151,"mirror_url":null,"open_issues_count":109,"forks":151,"open_issues":109,"watchers":287,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/4083"},"issue":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4083"},"comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4083/comments"},"review_comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083/comments"},"review_comment":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4083/commits"},"statuses":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/a9c2fa680ede1a1f976d3c0dd9fb366f45b02410"}}}}