New perf dashboard should not duplicate author information in each commit
[WebKit-https.git] / Websites / perf.webkit.org / public / api / report-commits.php
index 2c3fee3f78972e2b4615df08e5b95883d32326f0..18f4211ebdb194d2bc93b3a33caad1d52865d7d8 100644 (file)
@@ -34,6 +34,18 @@ function main($post_data) {
             exit_with_error('FailedToInsertRepository', array('commit' => $commit_info));
         }
 
             exit_with_error('FailedToInsertRepository', array('commit' => $commit_info));
         }
 
+        $account = array_get($commit_info['author'], 'account');
+        $committer_query = array('repository' => $repository_id, 'account' => $account);
+        $committer_data = $committer_query;
+        $name = array_get($commit_info['author'], 'name');
+        if ($name)
+            $committer_data['name'] = $name;
+        $committer_id = $db->update_or_insert_row('committers', 'committer', $committer_query, $committer_data);
+        if (!$committer_id) {
+            $db->rollback_transaction();
+            exit_with_error('FailedToInsertCommitter', array('committer' => $committer_data));
+        }
+
         $parent_revision = array_get($commit_info, 'parent');
         $parent_id = NULL;
         if ($parent_revision) {
         $parent_revision = array_get($commit_info, 'parent');
         $parent_id = NULL;
         if ($parent_revision) {
@@ -50,8 +62,7 @@ function main($post_data) {
             'revision' => $commit_info['revision'],
             'parent' => $parent_id,
             'time' => $commit_info['time'],
             'revision' => $commit_info['revision'],
             'parent' => $parent_id,
             'time' => $commit_info['time'],
-            'author_name' => array_get($commit_info['author'], 'name'),
-            'author_email' => array_get($commit_info['author'], 'email'),
+            'committer' => $committer_id,
             'message' => $commit_info['message'],
             'reported' => true,
         );
             'message' => $commit_info['message'],
             'reported' => true,
         );