git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: Make the by_tag filter delve in forks as well

From
Petr Baudis <pasky@suse.cz>
Date
Oct 2, 2008, 15:17 UTC
Message-ID
<1222960621-12044-1-git-send-email-pasky@suse.cz>
In-Reply-To
<1222960382-11619-1-git-send-email-pasky@suse.cz>

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>
---
 gitweb/gitweb.perl |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 02083d5..07fa1e6 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1880,9 +1880,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;
 				}
@@ -3715,6 +3713,7 @@ sub print_sort_th_num {
 }
 
 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');
@@ -3757,7 +3756,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 {
-- 
tg: (f429121..) t/tagcloud/forks (depends on: t/tagcloud/tagcloud)
Previous: Petr BaudisNext: Petr Baudis
Message 3 of 6 in “gitweb: Identify all summary metadata table rows”
  1. gitweb: Identify all summary metadata table rowsPetr Baudis, Oct 2, 2008
  2. gitweb: Support for tag cloudsPetr Baudis, Oct 2, 2008
  3. gitweb: Make the by_tag filter delve in forks as wellPetr Baudis, Oct 2, 2008
  4. gitweb: Support for simple project search formPetr Baudis, Oct 3, 2008
  5. Shawn O. PearceOct 3, 2008
  6. Jakub NarebskiOct 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.