diff --git a/src/GitList/Controller/CommitController.php b/src/GitList/Controller/CommitController.php index e017160..6e24c20 100644 --- a/src/GitList/Controller/CommitController.php +++ b/src/GitList/Controller/CommitController.php @@ -12,6 +12,15 @@ class CommitController implements ControllerProviderInterface { $route = $app['controllers_factory']; + $route->get('{repo}/commits/search', function (Request $request, $repo) use ($app) { + $subRequest = Request::create( + '/' . $repo . '/commits/master/search', + 'POST', + array('query' => $request->get('query')) + ); + return $app->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST); + })->assert('repo', $app['util.routing']->getRepositoryRegex()); + $route->get('{repo}/commits/{commitishPath}', function ($repo, $commitishPath) use ($app) { $repository = $app['git']->getRepository($app['git.repos'], $repo); diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index a4969a2..cc71e4a 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -241,6 +241,7 @@ class Repository extends BaseRepository public function searchCommitLog($query) { $query = escapeshellarg($query); + $query = strtr($query, array('[' => '\\[', ']' => '\\]')); $command = "log --grep={$query} --pretty=format:\"%H" . "%h%T%P" diff --git a/views/layout_page.twig b/views/layout_page.twig index 02919b9..45665af 100644 --- a/views/layout_page.twig +++ b/views/layout_page.twig @@ -8,11 +8,11 @@
{% if page in ['commits', 'searchcommits'] %} {% else %} {% endif %}