Skip to content

Commit

Permalink
gitweb: Use rev-list pattern search options.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Fitzsimons authored and Junio C Hamano committed Dec 23, 2006
1 parent 0a57617 commit 8e574fb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -4176,20 +4176,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) {
Expand Down

0 comments on commit 8e574fb

Please sign in to comment.