{"action":"created","comment":{"url":"https://api.github.com/repos/webgme/webgme/pulls/comments/49934756","id":49934756,"diff_hunk":"@@ -351,41 +354,46 @@ define([\n                     projectId: projectId,\n                     commitObject: null,\n                     coreObjects: null\n-                };\n+                },\n+                rootHash = Array.isArray(rootHash_es) ? rootHash_es[0] : rootHash_es,\n+                baseRootHash = Array.isArray(rootHash_es) ? rootHash_es[1] : null;\n \n             commitData.commitObject = self._getCommitObject(projectId, parents, rootHash, msg);\n             commitData.coreObjects = coreObjects;\n \n-            if (project) {\n-                project.insertObject(commitData.commitObject);\n-                commitId = commitData.commitObject[CONSTANTS.MONGO_ID];\n-\n-                commitCallback = function commitCallback() {\n-                    delete project.projectCache.queuedPersists[commitId];\n-                    self.logger.debug('Removed now persisted core-objects from cache: ',\n-                        Object.keys(project.projectCache.queuedPersists).length);\n-                    callback.apply(null, arguments);\n-                };\n-\n-                project.projectCache.queuedPersists[commitId] = coreObjects;\n-                logger.debug('Queued non-persisted core-objects in cache: ',\n-                    Object.keys(project.projectCache.queuedPersists).length);\n-            } else {\n-                commitCallback = callback;\n-            }\n+            self._fillPatchRoot(project, commitData, rootHash, baseRootHash)\n+                .then(function () {\n+                    if (project) {\n+                        project.insertObject(commitData.commitObject);\n+                        commitId = commitData.commitObject[CONSTANTS.MONGO_ID];\n+\n+                        commitCallback = function commitCallback() {\n+                            delete project.projectCache.queuedPersists[commitId];\n+                            self.logger.debug('Removed now persisted core-objects from cache: ',\n+                                Object.keys(project.projectCache.queuedPersists).length);\n+                            callback.apply(null, arguments);\n+                        };\n+\n+                        project.projectCache.queuedPersists[commitId] = coreObjects;\n+                        logger.debug('Queued non-persisted core-objects in cache: ',\n+                            Object.keys(project.projectCache.queuedPersists).length);\n+                    } else {\n+                        commitCallback = callback;\n+                    }\n \n-            if (typeof branchName === 'string') {\n-                commitData.branchName = branchName;\n-                branch = project ? project.branches[branchName] : null;\n-            }\n+                    if (typeof branchName === 'string') {\n+                        commitData.branchName = branchName;\n+                        branch = project ? project.branches[branchName] : null;\n+                    }\n \n-            logger.debug('makeCommit', commitData);\n-            if (branch) {\n-                logger.debug('makeCommit, branch is open will commit using commitQueue. branchName:', branchName);\n-                self._commitToBranch(projectId, branchName, commitData, parents[0], commitCallback);\n-            } else {\n-                webSocket.makeCommit(commitData, commitCallback);\n-            }\n+                    logger.debug('makeCommit', commitData);\n+                    if (branch) {\n+                        logger.debug('makeCommit, branch is open will commit using commitQueue. branchName:', branchName);\n+                        self._commitToBranch(projectId, branchName, commitData, parents[0], commitCallback);","path":"src/common/storage/storageclasses/editorstorage.js","position":143,"original_position":143,"commit_id":"017481638a514b50a22c08ae61eb5b1511af5b4a","original_commit_id":"017481638a514b50a22c08ae61eb5b1511af5b4a","user":{"login":"pmeijer","id":6518904,"avatar_url":"https://avatars.githubusercontent.com/u/6518904?v=3","gravatar_id":"","url":"https://api.github.com/users/pmeijer","html_url":"https://github.com/pmeijer","followers_url":"https://api.github.com/users/pmeijer/followers","following_url":"https://api.github.com/users/pmeijer/following{/other_user}","gists_url":"https://api.github.com/users/pmeijer/gists{/gist_id}","starred_url":"https://api.github.com/users/pmeijer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmeijer/subscriptions","organizations_url":"https://api.github.com/users/pmeijer/orgs","repos_url":"https://api.github.com/users/pmeijer/repos","events_url":"https://api.github.com/users/pmeijer/events{/privacy}","received_events_url":"https://api.github.com/users/pmeijer/received_events","type":"User","site_admin":false},"body":"The introduced asynchronousy will be an issue with multiple changes ","created_at":"2016-01-16T17:38:13Z","updated_at":"2016-01-16T17:38:13Z","html_url":"https://github.com/webgme/webgme/pull/789#discussion_r49934756","pull_request_url":"https://api.github.com/repos/webgme/webgme/pulls/789","_links":{"self":{"href":"https://api.github.com/repos/webgme/webgme/pulls/comments/49934756"},"html":{"href":"https://github.com/webgme/webgme/pull/789#discussion_r49934756"},"pull_request":{"href":"https://api.github.com/repos/webgme/webgme/pulls/789"}}},"pull_request":{"url":"https://api.github.com/repos/webgme/webgme/pulls/789","id":56180993,"html_url":"https://github.com/webgme/webgme/pull/789","diff_url":"https://github.com/webgme/webgme/pull/789.diff","patch_url":"https://github.com/webgme/webgme/pull/789.patch","issue_url":"https://api.github.com/repos/webgme/webgme/issues/789","number":789,"state":"open","locked":false,"title":"Patch Root Communication feature","user":{"login":"kecso","id":1371489,"avatar_url":"https://avatars.githubusercontent.com/u/1371489?v=3","gravatar_id":"","url":"https://api.github.com/users/kecso","html_url":"https://github.com/kecso","followers_url":"https://api.github.com/users/kecso/followers","following_url":"https://api.github.com/users/kecso/following{/other_user}","gists_url":"https://api.github.com/users/kecso/gists{/gist_id}","starred_url":"https://api.github.com/users/kecso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kecso/subscriptions","organizations_url":"https://api.github.com/users/kecso/orgs","repos_url":"https://api.github.com/users/kecso/repos","events_url":"https://api.github.com/users/kecso/events{/privacy}","received_events_url":"https://api.github.com/users/kecso/received_events","type":"User","site_admin":false},"body":"if config.storage.patchRootCommunicationEnabled is set to true the makeCommit will contain only a jsonPatch type root\r\nin every caches and storages the complete root object is saved though\r\nonly makeCommit and BRANCH_UPDATED event can contain the jsonPatch type root","created_at":"2016-01-15T15:17:57Z","updated_at":"2016-01-16T17:38:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ba8ea5575344d87d85b9b8a000d755fac1a5948","assignee":{"login":"pmeijer","id":6518904,"avatar_url":"https://avatars.githubusercontent.com/u/6518904?v=3","gravatar_id":"","url":"https://api.github.com/users/pmeijer","html_url":"https://github.com/pmeijer","followers_url":"https://api.github.com/users/pmeijer/followers","following_url":"https://api.github.com/users/pmeijer/following{/other_user}","gists_url":"https://api.github.com/users/pmeijer/gists{/gist_id}","starred_url":"https://api.github.com/users/pmeijer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmeijer/subscriptions","organizations_url":"https://api.github.com/users/pmeijer/orgs","repos_url":"https://api.github.com/users/pmeijer/repos","events_url":"https://api.github.com/users/pmeijer/events{/privacy}","received_events_url":"https://api.github.com/users/pmeijer/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/webgme/webgme/milestones/32","html_url":"https://github.com/webgme/webgme/milestones/v1.5.0","labels_url":"https://api.github.com/repos/webgme/webgme/milestones/32/labels","id":1509374,"number":32,"title":"v1.5.0","description":"","creator":{"login":"pmeijer","id":6518904,"avatar_url":"https://avatars.githubusercontent.com/u/6518904?v=3","gravatar_id":"","url":"https://api.github.com/users/pmeijer","html_url":"https://github.com/pmeijer","followers_url":"https://api.github.com/users/pmeijer/followers","following_url":"https://api.github.com/users/pmeijer/following{/other_user}","gists_url":"https://api.github.com/users/pmeijer/gists{/gist_id}","starred_url":"https://api.github.com/users/pmeijer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmeijer/subscriptions","organizations_url":"https://api.github.com/users/pmeijer/orgs","repos_url":"https://api.github.com/users/pmeijer/repos","events_url":"https://api.github.com/users/pmeijer/events{/privacy}","received_events_url":"https://api.github.com/users/pmeijer/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2016-01-15T17:25:03Z","updated_at":"2016-01-15T21:44:10Z","due_on":"2016-02-15T06:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/webgme/webgme/pulls/789/commits","review_comments_url":"https://api.github.com/repos/webgme/webgme/pulls/789/comments","review_comment_url":"https://api.github.com/repos/webgme/webgme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/webgme/webgme/issues/789/comments","statuses_url":"https://api.github.com/repos/webgme/webgme/statuses/017481638a514b50a22c08ae61eb5b1511af5b4a","head":{"label":"webgme:enhancement/compressed_root","ref":"enhancement/compressed_root","sha":"017481638a514b50a22c08ae61eb5b1511af5b4a","user":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"repo":{"id":2526173,"name":"webgme","full_name":"webgme/webgme","owner":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/webgme/webgme","description":"Web-based Generic Modeling Environment","fork":false,"url":"https://api.github.com/repos/webgme/webgme","forks_url":"https://api.github.com/repos/webgme/webgme/forks","keys_url":"https://api.github.com/repos/webgme/webgme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/webgme/webgme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/webgme/webgme/teams","hooks_url":"https://api.github.com/repos/webgme/webgme/hooks","issue_events_url":"https://api.github.com/repos/webgme/webgme/issues/events{/number}","events_url":"https://api.github.com/repos/webgme/webgme/events","assignees_url":"https://api.github.com/repos/webgme/webgme/assignees{/user}","branches_url":"https://api.github.com/repos/webgme/webgme/branches{/branch}","tags_url":"https://api.github.com/repos/webgme/webgme/tags","blobs_url":"https://api.github.com/repos/webgme/webgme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/webgme/webgme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/webgme/webgme/git/refs{/sha}","trees_url":"https://api.github.com/repos/webgme/webgme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/webgme/webgme/statuses/{sha}","languages_url":"https://api.github.com/repos/webgme/webgme/languages","stargazers_url":"https://api.github.com/repos/webgme/webgme/stargazers","contributors_url":"https://api.github.com/repos/webgme/webgme/contributors","subscribers_url":"https://api.github.com/repos/webgme/webgme/subscribers","subscription_url":"https://api.github.com/repos/webgme/webgme/subscription","commits_url":"https://api.github.com/repos/webgme/webgme/commits{/sha}","git_commits_url":"https://api.github.com/repos/webgme/webgme/git/commits{/sha}","comments_url":"https://api.github.com/repos/webgme/webgme/comments{/number}","issue_comment_url":"https://api.github.com/repos/webgme/webgme/issues/comments{/number}","contents_url":"https://api.github.com/repos/webgme/webgme/contents/{+path}","compare_url":"https://api.github.com/repos/webgme/webgme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/webgme/webgme/merges","archive_url":"https://api.github.com/repos/webgme/webgme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/webgme/webgme/downloads","issues_url":"https://api.github.com/repos/webgme/webgme/issues{/number}","pulls_url":"https://api.github.com/repos/webgme/webgme/pulls{/number}","milestones_url":"https://api.github.com/repos/webgme/webgme/milestones{/number}","notifications_url":"https://api.github.com/repos/webgme/webgme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/webgme/webgme/labels{/name}","releases_url":"https://api.github.com/repos/webgme/webgme/releases{/id}","created_at":"2011-10-06T14:01:08Z","updated_at":"2015-12-21T07:58:27Z","pushed_at":"2016-01-15T22:34:46Z","git_url":"git://github.com/webgme/webgme.git","ssh_url":"git@github.com:webgme/webgme.git","clone_url":"https://github.com/webgme/webgme.git","svn_url":"https://github.com/webgme/webgme","homepage":"https://webgme.org","size":126482,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":20,"forks":17,"open_issues":20,"watchers":26,"default_branch":"master"}},"base":{"label":"webgme:master","ref":"master","sha":"a96cc6b262dd277d16a4eaefe3cfff4b5724b29b","user":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"repo":{"id":2526173,"name":"webgme","full_name":"webgme/webgme","owner":{"login":"webgme","id":1107609,"avatar_url":"https://avatars.githubusercontent.com/u/1107609?v=3","gravatar_id":"","url":"https://api.github.com/users/webgme","html_url":"https://github.com/webgme","followers_url":"https://api.github.com/users/webgme/followers","following_url":"https://api.github.com/users/webgme/following{/other_user}","gists_url":"https://api.github.com/users/webgme/gists{/gist_id}","starred_url":"https://api.github.com/users/webgme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webgme/subscriptions","organizations_url":"https://api.github.com/users/webgme/orgs","repos_url":"https://api.github.com/users/webgme/repos","events_url":"https://api.github.com/users/webgme/events{/privacy}","received_events_url":"https://api.github.com/users/webgme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/webgme/webgme","description":"Web-based Generic Modeling Environment","fork":false,"url":"https://api.github.com/repos/webgme/webgme","forks_url":"https://api.github.com/repos/webgme/webgme/forks","keys_url":"https://api.github.com/repos/webgme/webgme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/webgme/webgme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/webgme/webgme/teams","hooks_url":"https://api.github.com/repos/webgme/webgme/hooks","issue_events_url":"https://api.github.com/repos/webgme/webgme/issues/events{/number}","events_url":"https://api.github.com/repos/webgme/webgme/events","assignees_url":"https://api.github.com/repos/webgme/webgme/assignees{/user}","branches_url":"https://api.github.com/repos/webgme/webgme/branches{/branch}","tags_url":"https://api.github.com/repos/webgme/webgme/tags","blobs_url":"https://api.github.com/repos/webgme/webgme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/webgme/webgme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/webgme/webgme/git/refs{/sha}","trees_url":"https://api.github.com/repos/webgme/webgme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/webgme/webgme/statuses/{sha}","languages_url":"https://api.github.com/repos/webgme/webgme/languages","stargazers_url":"https://api.github.com/repos/webgme/webgme/stargazers","contributors_url":"https://api.github.com/repos/webgme/webgme/contributors","subscribers_url":"https://api.github.com/repos/webgme/webgme/subscribers","subscription_url":"https://api.github.com/repos/webgme/webgme/subscription","commits_url":"https://api.github.com/repos/webgme/webgme/commits{/sha}","git_commits_url":"https://api.github.com/repos/webgme/webgme/git/commits{/sha}","comments_url":"https://api.github.com/repos/webgme/webgme/comments{/number}","issue_comment_url":"https://api.github.com/repos/webgme/webgme/issues/comments{/number}","contents_url":"https://api.github.com/repos/webgme/webgme/contents/{+path}","compare_url":"https://api.github.com/repos/webgme/webgme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/webgme/webgme/merges","archive_url":"https://api.github.com/repos/webgme/webgme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/webgme/webgme/downloads","issues_url":"https://api.github.com/repos/webgme/webgme/issues{/number}","pulls_url":"https://api.github.com/repos/webgme/webgme/pulls{/number}","milestones_url":"https://api.github.com/repos/webgme/webgme/milestones{/number}","notifications_url":"https://api.github.com/repos/webgme/webgme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/webgme/webgme/labels{/name}","releases_url":"https://api.github.com/repos/webgme/webgme/releases{/id}","created_at":"2011-10-06T14:01:08Z","updated_at":"2015-12-21T07:58:27Z","pushed_at":"2016-01-15T22:34:46Z","git_url":"git://github.com/webgme/webgme.git","ssh_url":"git@github.com:webgme/webgme.git","clone_url":"https://github.com/webgme/webgme.git","svn_url":"https://github.com/webgme/webgme","homepage":"https://webgme.org","size":126482,"stargazers_count":26,"watchers_count":26,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":20,"forks":17,"open_issues":20,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/webgme/webgme/pulls/789"},"html":{"href":"https://github.com/webgme/webgme/pull/789"},"issue":{"href":"https://api.github.com/repos/webgme/webgme/issues/789"},"comments":{"href":"https://api.github.com/repos/webgme/webgme/issues/789/comments"},"review_comments":{"href":"https://api.github.com/repos/webgme/webgme/pulls/789/comments"},"review_comment":{"href":"https://api.github.com/repos/webgme/webgme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/webgme/webgme/pulls/789/commits"},"statuses":{"href":"https://api.github.com/repos/webgme/webgme/statuses/017481638a514b50a22c08ae61eb5b1511af5b4a"}}}}