gitweb: Mark first match when searching commit messages
Due to greediness of a pattern, gitweb used to mark (show) last match in line, if there are more than one match in line. Now it shows first. Showing all matches in a line would require further work. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b00ac8c729
commit
6dfbb304be
@ -3837,7 +3837,7 @@ sub git_search_grep_body {
|
|||||||
chop_and_escape_str($co{'title'}, 50) . "<br/>");
|
chop_and_escape_str($co{'title'}, 50) . "<br/>");
|
||||||
my $comment = $co{'comment'};
|
my $comment = $co{'comment'};
|
||||||
foreach my $line (@$comment) {
|
foreach my $line (@$comment) {
|
||||||
if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
|
if ($line =~ m/^(.*?)($search_regexp)(.*)$/i) {
|
||||||
my ($lead, $match, $trail) = ($1, $2, $3);
|
my ($lead, $match, $trail) = ($1, $2, $3);
|
||||||
$match = chop_str($match, 70, 5, 'center');
|
$match = chop_str($match, 70, 5, 'center');
|
||||||
my $contextlen = int((80 - length($match))/2);
|
my $contextlen = int((80 - length($match))/2);
|
||||||
|
Reference in New Issue
Block a user