Skip to content

Commit 6dfbb30

Browse files
jnarebgitster
authored andcommitted
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>
1 parent b00ac8c commit 6dfbb30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3837,7 +3837,7 @@ sub git_search_grep_body {
38373837
chop_and_escape_str($co{'title'}, 50) . "<br/>");
38383838
my $comment = $co{'comment'};
38393839
foreach my $line (@$comment) {
3840-
if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
3840+
if ($line =~ m/^(.*?)($search_regexp)(.*)$/i) {
38413841
my ($lead, $match, $trail) = ($1, $2, $3);
38423842
$match = chop_str($match, 70, 5, 'center');
38433843
my $contextlen = int((80 - length($match))/2);

0 commit comments

Comments
 (0)