]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Support for simple project search form
[Gitweb] / gitweb.perl
index 66596b57f57deecd851690d49a00ebae5815e34b3a86d7af79dcf7aa7028b460..0a8c9e2199b5613d8a1c9f189466edf4769027daec6d87eab0f314c390543b15 100755 (executable)
@@ -3796,11 +3796,14 @@ sub git_project_list_body {
                my $pr = $projects[$i];
 
                next if $tagfilter and $show_ctags and not grep { lc $_ eq lc $tagfilter } keys %{$pr->{'ctags'}};
                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;
                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) {
                }
 
                if ($alternate) {
@@ -4137,6 +4140,11 @@ sub git_project_list {
                close $fd;
                print "</div>\n";
        }
                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();
 }
        git_project_list_body(\@list, $order);
        git_footer_html();
 }
This page took 0.203933 seconds and 4 git commands to generate.