@matheusbsbs / matheus-bagliano / commits / 42326110b5
Fork 0

gitweb: Make the by_tag filter delve in forks as well

This requires us to build a full index including forks and then weed them out only when printing. Signed-off-by: Petr Baudis <petr.baudis@novartis.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Petr Baudis committed Oct 2, 2008 at 17:17 UTC 42326110b5bb208e0a64e91aeca69a4f0cf5759e
1 file changed +10 -3
gitweb/gitweb.perl
+10 -3
@@ -1889,9 +1889,7 @@ sub git_get_projects_list {
1889
1890 my $subdir = substr($File::Find::name, $pfxlen + 1);
1891 # we check related file in $projectroot
1892 - if ($check_forks and $subdir =~ m#/.#) {
1893 - $File::Find::prune = 1;
1894 - } elsif (check_export_ok("$projectroot/$filter/$subdir")) {
1892 + if (check_export_ok("$projectroot/$filter/$subdir")) {
1893 push @list, { path => ($filter ? "$filter/" : '') . $subdir };
1894 $File::Find::prune = 1;
1895 }
@@ -3724,6 +3722,7 @@ sub print_sort_th_num {
3722 }
3723
3724 sub git_project_list_body {
3725 + # actually uses global variable $project
3726 my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
3727
3728 my ($check_forks) = gitweb_check_feature('forks');
@@ -3766,7 +3765,15 @@ sub git_project_list_body {
3765 my $tagfilter = $cgi->param('by_tag');
3766 for (my $i = $from; $i <= $to; $i++) {
3767 my $pr = $projects[$i];
3768 +
3769 next if $tagfilter and $show_ctags and not grep { lc $_ eq lc $tagfilter } keys %{$pr->{'ctags'}};
3770 + # Weed out forks
3771 + if ($check_forks) {
3772 + my $forkbase = $project; $forkbase ||= ''; $forkbase =~ s#\.git$#/#;
3773 + $forkbase="^$forkbase" if $forkbase;
3774 + next if not $tagfilter and $pr->{'path'} =~ m#$forkbase.*/.*#; # regexp-safe
3775 + }
3776 +
3777 if ($alternate) {
3778 print "<tr class=\"dark\">\n";
3779 } else {