git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] gitweb: Use rev-list pattern search options.
@ 2006-12-23  3:35 Robert Fitzsimons
  2006-12-23  3:35 ` [PATCH 2/3] gitweb: Require a minimum of two character for the search text Robert Fitzsimons
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Robert Fitzsimons @ 2006-12-23  3:35 UTC (permalink / raw)
  To: git; +Cc: Robert Fitzsimons

Use rev-list pattern search options instead of hand coded perl.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
 gitweb/gitweb.perl |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ebbc397..cc6bd0c 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4172,20 +4172,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) {
-- 
1.4.4.3.gae7ae3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-12-23 22:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-23  3:35 [PATCH 1/3] gitweb: Use rev-list pattern search options Robert Fitzsimons
2006-12-23  3:35 ` [PATCH 2/3] gitweb: Require a minimum of two character for the search text Robert Fitzsimons
2006-12-23  3:35   ` [PATCH 3/3] gitweb: Allow search to be disabled from the config file Robert Fitzsimons
2006-12-23  8:20     ` Jakub Narebski
2006-12-23 12:28       ` Robert Fitzsimons
2006-12-23 13:00         ` Jakub Narebski
2006-12-23 14:57           ` [PATCH] gitweb: Paginate commit/author/committer search output Robert Fitzsimons
2006-12-23 22:43             ` Jakub Narebski
2006-12-23  3:46 ` [PATCH 1/3] gitweb: Use rev-list pattern search options Robert Fitzsimons
2006-12-23  8:21 ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).