]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Make the by_tag filter delve in forks as well
authorPetr Baudis <redacted>
Thu, 2 Oct 2008 15:17:01 +0000 (17:17 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:38 +0000 (00:50 -0400)
This requires us to build a full index including forks and then weed
them out only when printing.

Signed-off-by: Petr Baudis <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
gitweb.perl

index 999414b4418e637cdeab24ace8b8692c82bde587521cd0a138e51d46d25ad656..66596b57f57deecd851690d49a00ebae5815e34b3a86d7af79dcf7aa7028b460 100755 (executable)
@@ -1910,9 +1910,7 @@ sub git_get_projects_list {
 
                                my $subdir = substr($File::Find::name, $pfxlen + 1);
                                # we check related file in $projectroot
-                               if ($check_forks and $subdir =~ m#/.#) {
-                                       $File::Find::prune = 1;
-                               } elsif (check_export_ok("$projectroot/$filter/$subdir")) {
+                               if (check_export_ok("$projectroot/$filter/$subdir")) {
                                        push @list, { path => ($filter ? "$filter/" : '') . $subdir };
                                        $File::Find::prune = 1;
                                }
@@ -3744,6 +3742,7 @@ sub print_sort_th {
 }
 
 sub git_project_list_body {
+       # actually uses global variable $project
        my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
 
        my ($check_forks) = gitweb_check_feature('forks');
@@ -3795,7 +3794,15 @@ sub git_project_list_body {
        my $tagfilter = $cgi->param('by_tag');
        for (my $i = $from; $i <= $to; $i++) {
                my $pr = $projects[$i];
+
                next if $tagfilter and $show_ctags and not grep { lc $_ eq lc $tagfilter } keys %{$pr->{'ctags'}};
+               # Weed out forks
+               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
+               }
+
                if ($alternate) {
                        print "<tr class=\"dark\">\n";
                } else {
This page took 0.331629 seconds and 4 git commands to generate.