diff --git a/src/plugins/git/__snapshots__/createGraph.test.js.snap b/src/plugins/git/__snapshots__/createGraph.test.js.snap index 770b7e0..ce31aab 100644 --- a/src/plugins/git/__snapshots__/createGraph.test.js.snap +++ b/src/plugins/git/__snapshots__/createGraph.test.js.snap @@ -10,7 +10,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, "src": Object { "id": "2f7155e359fd0ecb96ffdca66fa45b6ed5792809", "pluginName": "sourcecred/git-beta", @@ -25,7 +27,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, "src": Object { "id": "2f7155e359fd0ecb96ffdca66fa45b6ed5792809", "pluginName": "sourcecred/git-beta", @@ -57,7 +61,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, "src": Object { "id": "3dfb84795e07341b05fad3a0d5a55f8304b2d7d8", "pluginName": "sourcecred/git-beta", @@ -72,7 +78,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, "src": Object { "id": "3dfb84795e07341b05fad3a0d5a55f8304b2d7d8", "pluginName": "sourcecred/git-beta", @@ -87,7 +95,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, "src": Object { "id": "3dfb84795e07341b05fad3a0d5a55f8304b2d7d8", "pluginName": "sourcecred/git-beta", @@ -102,7 +112,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, "src": Object { "id": "3dfb84795e07341b05fad3a0d5a55f8304b2d7d8", "pluginName": "sourcecred/git-beta", @@ -117,7 +129,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, "src": Object { "id": "569e1d383759903134df75230d63c0090196d4cb", "pluginName": "sourcecred/git-beta", @@ -132,7 +146,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, "src": Object { "id": "569e1d383759903134df75230d63c0090196d4cb", "pluginName": "sourcecred/git-beta", @@ -147,7 +163,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "TODOS.txt", + }, "src": Object { "id": "569e1d383759903134df75230d63c0090196d4cb", "pluginName": "sourcecred/git-beta", @@ -162,7 +180,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, "src": Object { "id": "569e1d383759903134df75230d63c0090196d4cb", "pluginName": "sourcecred/git-beta", @@ -177,7 +197,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, "src": Object { "id": "569e1d383759903134df75230d63c0090196d4cb", "pluginName": "sourcecred/git-beta", @@ -192,7 +214,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "src", + }, "src": Object { "id": "569e1d383759903134df75230d63c0090196d4cb", "pluginName": "sourcecred/git-beta", @@ -224,7 +248,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "index.py", + }, "src": Object { "id": "78fc9c83023386854c6bfdc5761c0e58f68e226f", "pluginName": "sourcecred/git-beta", @@ -239,7 +265,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "quantum_gravity.py", + }, "src": Object { "id": "78fc9c83023386854c6bfdc5761c0e58f68e226f", "pluginName": "sourcecred/git-beta", @@ -254,7 +282,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "index.py", + }, "src": Object { "id": "7b79d579b62994faba3b69fdf8aa442586c32681", "pluginName": "sourcecred/git-beta", @@ -269,7 +299,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "quantum_gravity.py", + }, "src": Object { "id": "7b79d579b62994faba3b69fdf8aa442586c32681", "pluginName": "sourcecred/git-beta", @@ -284,7 +316,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, "src": Object { "id": "7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed", "pluginName": "sourcecred/git-beta", @@ -299,7 +333,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, "src": Object { "id": "7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed", "pluginName": "sourcecred/git-beta", @@ -314,7 +350,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, "src": Object { "id": "7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed", "pluginName": "sourcecred/git-beta", @@ -329,7 +367,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, "src": Object { "id": "7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed", "pluginName": "sourcecred/git-beta", @@ -344,7 +384,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "src", + }, "src": Object { "id": "7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed", "pluginName": "sourcecred/git-beta", @@ -359,7 +401,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, "src": Object { "id": "819fc546cea489476ce8dc90785e9ba7753d0a8f", "pluginName": "sourcecred/git-beta", @@ -374,7 +418,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, "src": Object { "id": "819fc546cea489476ce8dc90785e9ba7753d0a8f", "pluginName": "sourcecred/git-beta", @@ -389,7 +435,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "TODOS.txt", + }, "src": Object { "id": "819fc546cea489476ce8dc90785e9ba7753d0a8f", "pluginName": "sourcecred/git-beta", @@ -404,7 +452,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, "src": Object { "id": "819fc546cea489476ce8dc90785e9ba7753d0a8f", "pluginName": "sourcecred/git-beta", @@ -419,7 +469,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, "src": Object { "id": "819fc546cea489476ce8dc90785e9ba7753d0a8f", "pluginName": "sourcecred/git-beta", @@ -434,7 +486,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "src", + }, "src": Object { "id": "819fc546cea489476ce8dc90785e9ba7753d0a8f", "pluginName": "sourcecred/git-beta", @@ -1006,7 +1060,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, "src": Object { "id": "bbf3b8b3d26a4f884b5c022d46851f593d329192", "pluginName": "sourcecred/git-beta", @@ -1021,7 +1077,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, "src": Object { "id": "bbf3b8b3d26a4f884b5c022d46851f593d329192", "pluginName": "sourcecred/git-beta", @@ -1036,7 +1094,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "TODOS.txt", + }, "src": Object { "id": "bbf3b8b3d26a4f884b5c022d46851f593d329192", "pluginName": "sourcecred/git-beta", @@ -1051,7 +1111,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, "src": Object { "id": "bbf3b8b3d26a4f884b5c022d46851f593d329192", "pluginName": "sourcecred/git-beta", @@ -1066,7 +1128,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, "src": Object { "id": "bbf3b8b3d26a4f884b5c022d46851f593d329192", "pluginName": "sourcecred/git-beta", @@ -1081,7 +1145,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "src", + }, "src": Object { "id": "bbf3b8b3d26a4f884b5c022d46851f593d329192", "pluginName": "sourcecred/git-beta", @@ -1096,7 +1162,9 @@ Object { "repositoryName": "sourcecred/example-git", "type": "TREE_ENTRY", }, - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, "src": Object { "id": "bdff5d94193170015d6cbb549b7b630649428b1f", "pluginName": "sourcecred/git-beta", @@ -1164,10 +1232,14 @@ Object { "payload": Object {}, }, "{\\"id\\":\\"2f7155e359fd0ecb96ffdca66fa45b6ed5792809:README.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, }, "{\\"id\\":\\"2f7155e359fd0ecb96ffdca66fa45b6ed5792809:science.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, }, "{\\"id\\":\\"3715ddfb8d4c4fd2a6f6af75488c82f84c92ec2f\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"COMMIT\\"}": Object { "payload": Object {}, @@ -1176,37 +1248,57 @@ Object { "payload": Object {}, }, "{\\"id\\":\\"3dfb84795e07341b05fad3a0d5a55f8304b2d7d8:.gitmodules\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, }, "{\\"id\\":\\"3dfb84795e07341b05fad3a0d5a55f8304b2d7d8:README.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, }, "{\\"id\\":\\"3dfb84795e07341b05fad3a0d5a55f8304b2d7d8:pygravitydefier\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, }, "{\\"id\\":\\"3dfb84795e07341b05fad3a0d5a55f8304b2d7d8:science.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, }, "{\\"id\\":\\"569e1d383759903134df75230d63c0090196d4cb\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE\\"}": Object { "payload": Object {}, }, "{\\"id\\":\\"569e1d383759903134df75230d63c0090196d4cb:.gitmodules\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, }, "{\\"id\\":\\"569e1d383759903134df75230d63c0090196d4cb:README.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, }, "{\\"id\\":\\"569e1d383759903134df75230d63c0090196d4cb:TODOS.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "TODOS.txt", + }, }, "{\\"id\\":\\"569e1d383759903134df75230d63c0090196d4cb:pygravitydefier\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, }, "{\\"id\\":\\"569e1d383759903134df75230d63c0090196d4cb:science.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, }, "{\\"id\\":\\"569e1d383759903134df75230d63c0090196d4cb:src\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "src", + }, }, "{\\"id\\":\\"674b0b476989384510304846248b3acd16206782\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"BLOB\\"}": Object { "payload": Object {}, @@ -1218,58 +1310,88 @@ Object { "payload": Object {}, }, "{\\"id\\":\\"78fc9c83023386854c6bfdc5761c0e58f68e226f:index.py\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "index.py", + }, }, "{\\"id\\":\\"78fc9c83023386854c6bfdc5761c0e58f68e226f:quantum_gravity.py\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "quantum_gravity.py", + }, }, "{\\"id\\":\\"7b79d579b62994faba3b69fdf8aa442586c32681\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE\\"}": Object { "payload": Object {}, }, "{\\"id\\":\\"7b79d579b62994faba3b69fdf8aa442586c32681:index.py\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "index.py", + }, }, "{\\"id\\":\\"7b79d579b62994faba3b69fdf8aa442586c32681:quantum_gravity.py\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "quantum_gravity.py", + }, }, "{\\"id\\":\\"7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE\\"}": Object { "payload": Object {}, }, "{\\"id\\":\\"7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed:.gitmodules\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, }, "{\\"id\\":\\"7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed:README.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, }, "{\\"id\\":\\"7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed:pygravitydefier\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, }, "{\\"id\\":\\"7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed:science.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, }, "{\\"id\\":\\"7be3ecfee5314ffa9b2d93fc4377792b2d6d70ed:src\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "src", + }, }, "{\\"id\\":\\"819fc546cea489476ce8dc90785e9ba7753d0a8f\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE\\"}": Object { "payload": Object {}, }, "{\\"id\\":\\"819fc546cea489476ce8dc90785e9ba7753d0a8f:.gitmodules\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, }, "{\\"id\\":\\"819fc546cea489476ce8dc90785e9ba7753d0a8f:README.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, }, "{\\"id\\":\\"819fc546cea489476ce8dc90785e9ba7753d0a8f:TODOS.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "TODOS.txt", + }, }, "{\\"id\\":\\"819fc546cea489476ce8dc90785e9ba7753d0a8f:pygravitydefier\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, }, "{\\"id\\":\\"819fc546cea489476ce8dc90785e9ba7753d0a8f:science.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, }, "{\\"id\\":\\"819fc546cea489476ce8dc90785e9ba7753d0a8f:src\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "src", + }, }, "{\\"id\\":\\"887ad856bbc1373da146106c86cb581ad78cdafe\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"BLOB\\"}": Object { "payload": Object {}, @@ -1287,28 +1409,42 @@ Object { "payload": Object {}, }, "{\\"id\\":\\"bbf3b8b3d26a4f884b5c022d46851f593d329192:.gitmodules\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": ".gitmodules", + }, }, "{\\"id\\":\\"bbf3b8b3d26a4f884b5c022d46851f593d329192:README.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, }, "{\\"id\\":\\"bbf3b8b3d26a4f884b5c022d46851f593d329192:TODOS.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "TODOS.txt", + }, }, "{\\"id\\":\\"bbf3b8b3d26a4f884b5c022d46851f593d329192:pygravitydefier\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "pygravitydefier", + }, }, "{\\"id\\":\\"bbf3b8b3d26a4f884b5c022d46851f593d329192:science.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "science.txt", + }, }, "{\\"id\\":\\"bbf3b8b3d26a4f884b5c022d46851f593d329192:src\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "src", + }, }, "{\\"id\\":\\"bdff5d94193170015d6cbb549b7b630649428b1f\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE\\"}": Object { "payload": Object {}, }, "{\\"id\\":\\"bdff5d94193170015d6cbb549b7b630649428b1f:README.txt\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"TREE_ENTRY\\"}": Object { - "payload": Object {}, + "payload": Object { + "name": "README.txt", + }, }, "{\\"id\\":\\"c08ee3a4edea384d5291ffcbf06724a13ed72325\\",\\"pluginName\\":\\"sourcecred/git-beta\\",\\"repositoryName\\":\\"sourcecred/example-git\\",\\"type\\":\\"COMMIT\\"}": Object { "payload": Object {}, diff --git a/src/plugins/git/createGraph.js b/src/plugins/git/createGraph.js index 139ff6e..6595986 100644 --- a/src/plugins/git/createGraph.js +++ b/src/plugins/git/createGraph.js @@ -1,14 +1,17 @@ // @flow import type {Address} from "../../core/address"; +import type {Edge, Node} from "../../core/graph"; import type { - Repository, Commit, - Tree, - NodePayload, EdgePayload, - NodeType, EdgeType, + IncludesEdgePayload, + NodePayload, + NodeType, + Repository, + Tree, + TreeEntryNodePayload, } from "./types"; import {Graph, edgeID} from "../../core/graph"; import { @@ -103,21 +106,21 @@ class GitGraphCreator { const result = new Graph().addNode(treeNode); Object.keys(tree.entries).forEach((name) => { const entry = tree.entries[name]; - const entryNode = { + const entryNode: Node = { address: this.makeAddress( TREE_ENTRY_NODE_TYPE, treeEntryId(tree.hash, entry.name) ), - payload: {}, + payload: {name}, }; - const entryEdge = { + const entryEdge: Edge = { address: this.makeAddress( INCLUDES_EDGE_TYPE, includesEdgeId(tree.hash, entry.name) ), src: treeNode.address, dst: entryNode.address, - payload: {}, + payload: {name}, }; result.addNode(entryNode).addEdge(entryEdge); if (entry.type === "commit") { diff --git a/src/plugins/git/types.js b/src/plugins/git/types.js index 489f9fa..c10d19d 100644 --- a/src/plugins/git/types.js +++ b/src/plugins/git/types.js @@ -36,9 +36,11 @@ export const BLOB_NODE_TYPE: "BLOB" = "BLOB"; export type BlobNodePayload = {||}; // we do not store the content export const TREE_ENTRY_NODE_TYPE: "TREE_ENTRY" = "TREE_ENTRY"; -export type TreeEntryNodePayload = {||}; -export function treeEntryId(treeSha: string, name: string): string { - return `${treeSha}:${name}`; +export type TreeEntryNodePayload = {| + +name: string, +|}; +export function treeEntryId(tree: Hash, name: string): string { + return `${tree}:${name}`; } export type NodePayload = @@ -83,7 +85,9 @@ export type HasTreeEdgePayload = {||}; // TreeNode -> TreeEntryNode export const INCLUDES_EDGE_TYPE: "INCLUDES" = "INCLUDES"; -export type IncludesEdgePayload = {||}; +export type IncludesEdgePayload = {| + +name: string, +|}; export function includesEdgeId(treeSha: string, name: string): string { return `${treeSha}:${name}`; }