git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: Mark first match when searching commit messages
@ 2008-03-02 15:57 Jakub Narebski
  0 siblings, 0 replies; only message in thread
From: Jakub Narebski @ 2008-03-02 15:57 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

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>
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 20dc5d5..922dee9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3837,7 +3837,7 @@ sub git_search_grep_body {
 		              chop_and_escape_str($co{'title'}, 50) . "<br/>");
 		my $comment = $co{'comment'};
 		foreach my $line (@$comment) {
-			if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
+			if ($line =~ m/^(.*?)($search_regexp)(.*)$/i) {
 				my ($lead, $match, $trail) = ($1, $2, $3);
 				$match = chop_str($match, 70, 5, 'center');
 				my $contextlen = int((80 - length($match))/2);
-- 
1.5.4.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-02 15:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-02 15:57 [PATCH] gitweb: Mark first match when searching commit messages Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).