summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jakub Narebski <jnareb@gmail.com>2008-03-02 16:57:14 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-03-02 15:26:31 -0800
commit6dfbb304be5a5e260321c5f47626582dbe2c62f0 (patch)
tree79db1bc404ac040c1e68468703b8ed7c8bfce5d9
parentMerge branch 'sp/describe-tag' (diff)
downloadtgif-6dfbb304be5a5e260321c5f47626582dbe2c62f0.tar.xz
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>
-rwxr-xr-xgitweb/gitweb.perl2
1 files changed, 1 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 20dc5d59c2..922dee98b9 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);