diff --git a/src/GitList/Controller/CommitController.php b/src/GitList/Controller/CommitController.php index 776f669..ad4648d 100644 --- a/src/GitList/Controller/CommitController.php +++ b/src/GitList/Controller/CommitController.php @@ -45,7 +45,7 @@ class CommitController implements ControllerProviderInterface ->value('file', '') ->bind('commits'); - $route->post('{repo}/commits/search', function(Request $request, $repo) use ($app) { + $route->post('{repo}/commits/{branch}/search', function(Request $request, $repo, $branch = '') use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); $commits = $repository->searchCommitLog($request->get('query')); @@ -57,13 +57,14 @@ class CommitController implements ControllerProviderInterface return $app['twig']->render('searchcommits.twig', array( 'repo' => $repo, - 'branch' => 'master', + 'branch' => $branch, 'file' => '', 'commits' => $categorized, 'branches' => $repository->getBranches(), 'tags' => $repository->getTags(), )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) + ->assert('branch', '[\w-._\/]+') ->bind('searchcommits'); $route->get('{repo}/commit/{commit}/', function($repo, $commit) use ($app) { diff --git a/views/layout_page.twig b/views/layout_page.twig index 97f51f3..02919b9 100644 --- a/views/layout_page.twig +++ b/views/layout_page.twig @@ -6,8 +6,8 @@