- while (my $commit_text = <$fd>) {
- if (!grep m/$searchtext/, $commit_text) {
- next;
- }
- my @commit_lines = split "\n", $commit_text;
- my $commit = shift @commit_lines;
- my %co = git_read_commit($commit, \@commit_lines);
- if (!%co) {
- next;
- }
- if ($alternate) {
- print "<tr style=\"background-color:#f6f5ed\">\n";
- } else {
- print "<tr>\n";
- }
- $alternate ^= 1;
- print "<td><i>$co{'age_string'}</i></td>\n" .
- "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
- "<td>" .
- $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, "<b>" . escapeHTML(chop_str($co{'title'}, 50)) . "</b><br/>");
- my $comment = $co{'comment'};
- foreach my $line (@$comment) {
- if ($line =~ m/^(.*)($searchtext)(.*)$/) {
- my $lead = escapeHTML($1) || "";
- $lead = chop_str($lead, 30, 10);
- my $match = escapeHTML($2) || "";
- my $trail = escapeHTML($3) || "";
- $trail = chop_str($trail, 30, 10);
- my $text = "$lead<span style=\"color:#e00000\">$match</span>$trail";
- print chop_str($text, 80, 5) . "<br/>\n";
+ if ($commit_search) {
+ $/ = "\0";
+ open my $fd, "-|", "$gitbin/git-rev-list --header $hash";
+ while (my $commit_text = <$fd>) {
+ if (!grep m/$searchtext/i, $commit_text) {
+ next;