Issue #61: Read default branch from .git/HEAD

This commit is contained in:
Dave Hall
2012-06-26 21:04:37 +10:00
parent ad67163c09
commit 19d80921f0
3 changed files with 24 additions and 4 deletions

View File

@@ -2,7 +2,8 @@
$app->get('{repo}/', function($repo) use($app) {
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
$tree = $repository->getTree('master');
$defaultBranch = $repository->getHead();
$tree = $repository->getTree($defaultBranch);
$breadcrumbs = $app['utils']->getBreadcrumbs("$repo/");
return $app['twig']->render('tree.twig', array(
@@ -10,7 +11,7 @@ $app->get('{repo}/', function($repo) use($app) {
'page' => 'files',
'files' => $tree->output(),
'repo' => $repo,
'branch' => 'master',
'branch' => $defaultBranch,
'path' => '',
'parent' => '',
'breadcrumbs' => $breadcrumbs,
@@ -66,4 +67,4 @@ $app->get('{repo}/tree/{branch}/{tree}/', function($repo, $branch, $tree) use($a
));
})->assert('tree', '.+')
->assert('repo', '[\w-._]+')
->assert('branch', '[\w-._]+');
->assert('branch', '[\w-._]+');