Plugins create dangling edges

The GitHub plugin no longer adds a Node to the graph for Git commits.
Instead, it creates a dangling edge to it. This frees the GitHub plugin
from responsibility for setting the timestamp or other metadata for Git
nodes.

The Git plugin no longer adds a Commit Node to the graph immediately when
encountering a commit's parent hash. Instead, it creates an edge to the
parent, and then fills in the parent node once it is encountered in the
commit store.

Test plan: Load a real repository with merged pull requests
(e.g. sourcecred/research) into the explorer, and verify that GitHub
commit entities are still connected to Git commits, and that Git
commits are still connected to their parents.
This commit is contained in:
Dandelion Mané 2019-07-03 13:14:08 +01:00
parent 02a8e02922
commit e7add05df5
3 changed files with 0 additions and 21 deletions

View File

@ -34,7 +34,6 @@ class GraphCreator {
this.graph.addNode({address: GN.toRaw(node)}); this.graph.addNode({address: GN.toRaw(node)});
for (const parentHash of commit.parentHashes) { for (const parentHash of commit.parentHashes) {
const parent: GN.CommitAddress = {type: GN.COMMIT_TYPE, hash: parentHash}; const parent: GN.CommitAddress = {type: GN.COMMIT_TYPE, hash: parentHash};
this.graph.addNode({address: GN.toRaw(parent)});
this.graph.addEdge(GE.createEdge.hasParent(node, parent)); this.graph.addEdge(GE.createEdge.hasParent(node, parent));
} }
} }

View File

@ -2560,24 +2560,6 @@ Array [
}, },
], ],
"nodes": Array [ "nodes": Array [
Object {
"index": 0,
},
Object {
"index": 1,
},
Object {
"index": 2,
},
Object {
"index": 3,
},
Object {
"index": 4,
},
Object {
"index": 5,
},
Object { Object {
"index": 6, "index": 6,
}, },

View File

@ -45,8 +45,6 @@ class GraphCreator {
type: GitNode.COMMIT_TYPE, type: GitNode.COMMIT_TYPE,
hash: commit.hash(), hash: commit.hash(),
}; };
const gitCommit = GitNode.toRaw(gitCommitAddress);
this.graph.addNode({address: gitCommit});
this.graph.addEdge( this.graph.addEdge(
createEdge.correspondsToCommit(commit.address(), gitCommitAddress) createEdge.correspondsToCommit(commit.address(), gitCommitAddress)
); );