@matheusbsbs / matheus-bagliano / commits / 6dfbb304be
Fork 0

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>

Jakub Narebski committed Mar 2, 2008 at 16:57 UTC 6dfbb304be5a5e260321c5f47626582dbe2c62f0
1 file changed +1 -1
gitweb/gitweb.perl
+1 -1
@@ -3837,7 +3837,7 @@ sub git_search_grep_body {
3837 chop_and_escape_str($co{'title'}, 50) . "<br/>");
3838 my $comment = $co{'comment'};
3839 foreach my $line (@$comment) {
3840 - if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
3840 + if ($line =~ m/^(.*?)($search_regexp)(.*)$/i) {
3841 my ($lead, $match, $trail) = ($1, $2, $3);
3842 $match = chop_str($match, 70, 5, 'center');
3843 my $contextlen = int((80 - length($match))/2);