Skip to content

Commit 4232611

Browse files
Petr Baudisspearce
authored andcommitted
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 <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent aed93de commit 4232611

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

gitweb/gitweb.perl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,9 +1889,7 @@ sub git_get_projects_list {
18891889

18901890
my $subdir = substr($File::Find::name, $pfxlen + 1);
18911891
# 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")) {
18951893
push @list, { path => ($filter ? "$filter/" : '') . $subdir };
18961894
$File::Find::prune = 1;
18971895
}
@@ -3724,6 +3722,7 @@ sub print_sort_th_num {
37243722
}
37253723

37263724
sub git_project_list_body {
3725+
# actually uses global variable $project
37273726
my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
37283727

37293728
my ($check_forks) = gitweb_check_feature('forks');
@@ -3766,7 +3765,15 @@ sub git_project_list_body {
37663765
my $tagfilter = $cgi->param('by_tag');
37673766
for (my $i = $from; $i <= $to; $i++) {
37683767
my $pr = $projects[$i];
3768+
37693769
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+
37703777
if ($alternate) {
37713778
print "<tr class=\"dark\">\n";
37723779
} else {

0 commit comments

Comments
 (0)