diff --git a/src/GitList/Controller/CommitController.php b/src/GitList/Controller/CommitController.php index 86dc4093..b6be3be2 100644 --- a/src/GitList/Controller/CommitController.php +++ b/src/GitList/Controller/CommitController.php @@ -12,6 +12,15 @@ public function connect(Application $app) { $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']->getRepositoryFromName($app['git.repos'], $repo); diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index d8dd347a..08787c87 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -241,6 +241,7 @@ public function getPaginatedCommits($file = null, $page = 0) 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 02919b97..45665af0 100644 --- a/views/layout_page.twig +++ b/views/layout_page.twig @@ -8,11 +8,11 @@
{% if page in ['commits', 'searchcommits'] %} {% else %} {% endif %}