{"thread":{"id":"12429","subject":"[PATCH] gitweb: Mark first match when searching commit messages","startedAt":"2008-03-02T15:57:14Z","lastAt":"2008-03-02T15:57:14Z","messageCount":1,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"70654","messageId":"1204473434-26023-1-git-send-email-jnareb@gmail.com","threadId":"12429","inReplyTo":null,"subject":"[PATCH] gitweb: Mark first match when searching commit messages","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-03-02T15:57:14Z","receivedAt":"2008-03-02T15:57:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Due to greediness of a pattern, gitweb used to mark (show) last match\nin line, if there are more than one match in line. Now it shows first.\nShowing all matches in a line would require further work.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 20dc5d5..922dee9 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3837,7 +3837,7 @@ sub git_search_grep_body {\n \t\t              chop_and_escape_str($co{'title'}, 50) . \"<br/>\");\n \t\tmy $comment = $co{'comment'};\n \t\tforeach my $line (@$comment) {\n-\t\t\tif ($line =~ m/^(.*)($search_regexp)(.*)$/i) {\n+\t\t\tif ($line =~ m/^(.*?)($search_regexp)(.*)$/i) {\n \t\t\t\tmy ($lead, $match, $trail) = ($1, $2, $3);\n \t\t\t\t$match = chop_str($match, 70, 5, 'center');\n \t\t\t\tmy $contextlen = int((80 - length($match))/2);\n-- \n1.5.4.2\n\n"}]}