/** * Parse the response of a git-log command. * * @param Repository $repository The project repository * @param string $output * @return array<Commit> */ public static function parse(Repository $repository, $output) { $commits = array(); if (!empty($output)) { foreach (explode("\n", $output) as $line) { $commit = new Commit($repository, 'HEAD'); $commit->init($line); $commits[$commit->getHash()] = $commit; } } return $commits; }