]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Use rev-list pattern search options.
authorRobert Fitzsimons <redacted>
Sat, 23 Dec 2006 03:35:14 +0000 (03:35 +0000)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
Use rev-list pattern search options instead of hand coded perl.

Signed-off-by: Robert Fitzsimons <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 11e849fc8661314b2728d760eb196ea42dc66d38ebfd0b8e9697763229ff11b8..84a3b1a9a2bc80df578b4c0543549b88ae297f4ba84824303632950218c9273b 100755 (executable)
@@ -4177,20 +4177,20 @@ sub git_search {
        print "<table cellspacing=\"0\">\n";
        my $alternate = 1;
        if ($searchtype eq 'commit' or $searchtype eq 'author' or $searchtype eq 'committer') {
+               my $greptype;
+               if ($searchtype eq 'commit') {
+                       $greptype = "--grep=";
+               } elsif ($searchtype eq 'author') {
+                       $greptype = "--author=";
+               } elsif ($searchtype eq 'committer') {
+                       $greptype = "--committer=";
+               }
                $/ = "\0";
                open my $fd, "-|", git_cmd(), "rev-list",
-                       "--header", "--parents", $hash, "--"
+                       "--header", "--parents", ($greptype . $searchtext),
+                        $hash, "--"
                        or next;
                while (my $commit_text = <$fd>) {
-                       if (!grep m/$searchtext/i, $commit_text) {
-                               next;
-                       }
-                       if ($searchtype eq 'author' && !grep m/\nauthor .*$searchtext/i, $commit_text) {
-                               next;
-                       }
-                       if ($searchtype eq 'committer' && !grep m/\ncommitter .*$searchtext/i, $commit_text) {
-                               next;
-                       }
                        my @commit_lines = split "\n", $commit_text;
                        my %co = parse_commit(undef, \@commit_lines);
                        if (!%co) {
This page took 0.19498 seconds and 4 git commands to generate.