summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4232611)
raw | patch | inline | side by side (parent: 4232611)
author | Petr Baudis <pasky@suse.cz> | |
Fri, 3 Oct 2008 07:29:45 +0000 (09:29 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 3 Oct 2008 14:29:56 +0000 (07:29 -0700) |
This is a trivial patch adding support for searching projects by name
and description, making use of the "infrastructure" provided by the
tag cloud generation.
Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
and description, making use of the "infrastructure" provided by the
tag cloud generation.
Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
gitweb/gitweb.css | patch | blob | history | |
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 07f5b5378805a520e22b0f1b598aed7af4235538..a01eac814e51edd2115474f4d48a8d7fafa8c0e6 100644 (file)
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
right: 12px
}
+p.projsearch {
+ text-align: center;
+}
+
td.linenr {
text-align: right;
}
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 99fdb13f1f8c02696a0e1ed46ec8581c7d27af97..b46af77da0bd61aed5eb7977fecb03d4034d4911 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
my $pr = $projects[$i];
next if $tagfilter and $show_ctags and not grep { lc $_ eq lc $tagfilter } keys %{$pr->{'ctags'}};
- # Weed out forks
+ next if $searchtext and not $pr->{'path'} =~ /$searchtext/
+ and not $pr->{'descr_long'} =~ /$searchtext/;
+ # Weed out forks or non-matching entries of search
if ($check_forks) {
my $forkbase = $project; $forkbase ||= ''; $forkbase =~ s#\.git$#/#;
$forkbase="^$forkbase" if $forkbase;
- next if not $tagfilter and $pr->{'path'} =~ m#$forkbase.*/.*#; # regexp-safe
+ next if not $searchtext and not $tagfilter and $show_ctags
+ and $pr->{'path'} =~ m#$forkbase.*/.*#; # regexp-safe
}
if ($alternate) {
close $fd;
print "</div>\n";
}
+ print $cgi->startform(-method => "get") .
+ "<p class=\"projsearch\">Search:\n" .
+ $cgi->textfield(-name => "s", -value => $searchtext) . "\n" .
+ "</p>" .
+ $cgi->end_form() . "\n";
git_project_list_body(\@list, $order);
git_footer_html();
}