Code for loading repo in TreeController.

This commit is contained in:
Wim Rijnders
2012-12-04 07:06:43 +01:00
parent b644610438
commit eb9e660f5b

View File

@@ -75,20 +75,16 @@ echo "searc\n";
->assert('branch', '[\w-._\/]+') ->assert('branch', '[\w-._\/]+')
->bind('search'); ->bind('search');
$route->get('{repo}/{branch}/', function($repo, $branch) use ($app, $treeController) {
return $treeController($repo, $branch);
})->assert('repo', $app['util.routing']->getRepositoryRegex())
->assert('branch', '[\w-._\/]+')
->bind('branch');
$route->get('{repo}/', function($repo) use ($app, $treeController) {
return $treeController($repo);
})->assert('repo', $app['util.routing']->getRepositoryRegex())
->bind('repository');
# WRI: Changed order of this and next statement, because order
# appears to be important, and the other statement got precedence
$route->get('{repo}/{format}ball/{branch}', function($repo, $format, $branch) use ($app) { $route->get('{repo}/{format}ball/{branch}', function($repo, $format, $branch) use ($app) {
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo); echo "tarball\n";
$path = $repository->getPath();
$repo_item = $app['git']->getRepositoryCached($app['git.repos'], $repo);
$path = $repo_item->getPath();
$repository = $app['git']->getRepository($path );
$tree = $repository->getBranchTree($branch); $tree = $repository->getBranchTree($branch);
@@ -120,6 +116,19 @@ echo "searc\n";
->assert('branch', '[\w-._\/]+') ->assert('branch', '[\w-._\/]+')
->bind('archive'); ->bind('archive');
$route->get('{repo}/{branch}/', function($repo, $branch) use ($app, $treeController) {
return $treeController($repo, $branch);
})->assert('repo', $app['util.routing']->getRepositoryRegex())
->assert('branch', '[\w-._\/]+')
->bind('branch');
$route->get('{repo}/', function($repo) use ($app, $treeController) {
return $treeController($repo);
})->assert('repo', $app['util.routing']->getRepositoryRegex())
->bind('repository');
return $route; return $route;
} }
} }