Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistGitAPI.php
Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | if (!strlen($info)) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$info = explode("\2", $info); | $info = explode("\2", $info); | ||||
foreach ($info as $line) { | foreach ($info as $line) { | ||||
list($commit, $tree, $parents, $time, $author, $author_email, | list($commit, $tree, $parents, $time, $author, $author_email, | ||||
$title, $message) = explode("\1", trim($line), 8); | $title, $message) = explode("\1", trim($line), 8); | ||||
$message = rtrim($message); | $message = rtrim($message); | ||||
$co_authors = array(); | |||||
foreach (explode("\n", $message) as $message_line) { | |||||
if (strncasecmp($message_line, 'Co-authored-by:', 15) !== 0) { | |||||
continue; | |||||
} | |||||
$matches = array(); | |||||
$status = preg_match( | |||||
'/^co-authored-by:\s*(.*)<(.*)>/i', | |||||
$message_line, | |||||
$matches); | |||||
if ($status !== 1) { | |||||
continue; | |||||
} | |||||
$co_authors[] = array( | |||||
'name' => trim($matches[1]), | |||||
'email' => trim($matches[2]), | |||||
); | |||||
} | |||||
$commits[$commit] = array( | $commits[$commit] = array( | ||||
'commit' => $commit, | 'commit' => $commit, | ||||
'tree' => $tree, | 'tree' => $tree, | ||||
'parents' => array_filter(explode(' ', $parents)), | 'parents' => array_filter(explode(' ', $parents)), | ||||
'time' => $time, | 'time' => $time, | ||||
'author' => $author, | 'author' => $author, | ||||
'summary' => $title, | 'summary' => $title, | ||||
'message' => $message, | 'message' => $message, | ||||
'authorEmail' => $author_email, | 'authorEmail' => $author_email, | ||||
'coAuthors' => $co_authors, | |||||
avivey: Looks like we already upload the entire commit message - can we do this logic in the server… | |||||
); | ); | ||||
} | } | ||||
return $commits; | return $commits; | ||||
} | } | ||||
protected function buildBaseCommit($symbolic_commit) { | protected function buildBaseCommit($symbolic_commit) { | ||||
if ($symbolic_commit !== null) { | if ($symbolic_commit !== null) { | ||||
▲ Show 20 Lines • Show All 1,616 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
Looks like we already upload the entire commit message - can we do this logic in the server, avoiding adding this key to the API?