public function tree($owner, $project, $commitishPath = '')
{
$repository = $project->getRepository();
if (!$commitishPath) {
$commitishPath = $repository->getHead();
}
list($branch, $tree) = $this->extractReference($repository, $commitishPath, $project->slug);
$breadcrumbs = app('git_util')->getBreadcrumbs($tree);
$parent = null;
if (($slash = strrpos($tree, '/')) !== false) {
$parent = substr($tree, 0, $slash);
} elseif (!empty($tree)) {
$parent = '';
}
$readme = $parent === null ? app('git_util')->getReadme($repository, $branch, $tree ? "{$tree}" : '') : '';
$path = $tree ? $tree . '/' : $tree;
return View::make('projects/tree')->withLatestCommit($repository->getLatestCommit($path))->withfiles($this->getFiles($repository, $tree, $branch, $path))->withOwner($owner)->withProject($project)->withBranch($branch)->withPath($path)->withBreadcrumbs($breadcrumbs)->withParent($parent)->withBranches($repository->getBranches())->withTags($repository->getTags())->withReadme($readme);
}