public function index($owner, $project, $commitishPath)
{
$repository = $project->getRepository();
if (!$commitishPath) {
$commitishPath = $repository->getHead();
}
list($branch, $file) = $this->extractReference($repository, $commitishPath, $project->slug);
$type = $file ? "{$branch} -- \"{$file}\"" : $branch;
$pager = $this->getPager(Input::get('page'), $repository->getTotalCommits($type));
$commits = $repository->getPaginatedCommits($type, $pager['current']);
$categorized = [];
foreach ($commits as $commit) {
$date = $commit->getCommiterDate();
$date = $date->format('Y-m-d');
$categorized[$date][] = $commit;
}
$template = Request::ajax() ? 'commits_list' : 'commits';
return View::make('projects/' . $template)->withPage('commits')->withPager($pager)->withOwner($owner)->withProject($project)->withBranch($branch)->withBranches($repository->getBranches())->withTags($repository->getTags())->withFile($file)->withCommits($categorized);
}