@matheusbsbs / matheus-bagliano / commits / 8e574fb542
Fork 0

gitweb: Use rev-list pattern search options.

Use rev-list pattern search options instead of hand coded perl. Signed-off-by: Robert Fitzsimons <robfitz@273k.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Robert Fitzsimons committed Dec 23, 2006 at 03:35 UTC 8e574fb542eaf7f41d5416b2cf65b5c2e93829d6
1 file changed +10 -10
gitweb/gitweb.perl
+10 -10
@@ -4176,20 +4176,20 @@ sub git_search {
4176 print "<table cellspacing=\"0\">\n";
4177 my $alternate = 1;
4178 if ($searchtype eq 'commit' or $searchtype eq 'author' or $searchtype eq 'committer') {
4179 + my $greptype;
4180 + if ($searchtype eq 'commit') {
4181 + $greptype = "--grep=";
4182 + } elsif ($searchtype eq 'author') {
4183 + $greptype = "--author=";
4184 + } elsif ($searchtype eq 'committer') {
4185 + $greptype = "--committer=";
4186 + }
4187 $/ = "\0";
4188 open my $fd, "-|", git_cmd(), "rev-list",
4181 - "--header", "--parents", $hash, "--"
4189 + "--header", "--parents", ($greptype . $searchtext),
4190 + $hash, "--"
4191 or next;
4192 while (my $commit_text = <$fd>) {
4184 - if (!grep m/$searchtext/i, $commit_text) {
4185 - next;
4186 - }
4187 - if ($searchtype eq 'author' && !grep m/\nauthor .*$searchtext/i, $commit_text) {
4188 - next;
4189 - }
4190 - if ($searchtype eq 'committer' && !grep m/\ncommitter .*$searchtext/i, $commit_text) {
4191 - next;
4192 - }
4193 my @commit_lines = split "\n", $commit_text;
4194 my %co = parse_commit(undef, \@commit_lines);
4195 if (!%co) {