[PATCH(resend)] gitweb: Allow forks with project list file

Previous thread: [PATCH 5/5] cvsimport: Improve formating consistency by Frank Lichtenheld on Friday, April 6, 2007 - 2:52 pm. (1 message)

Next thread: [PATCH(resend)] gitweb: Allow configuring the default projects order and add order 'none' by Frank Lichtenheld on Friday, April 6, 2007 - 2:58 pm. (3 messages)
From: Frank Lichtenheld
Date: Friday, April 6, 2007 - 2:58 pm

Make it possible to use the forks feature even when
reading the list of projects from a file, by creating
a list of known prefixes as we go. Forks have to be
listed after the main project in order to be recognised
as such.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
 gitweb/gitweb.perl |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

Probably got lost in the noise since I never received a comment on it.

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ea49156..379c89c 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -176,8 +176,8 @@ our %feature = (
 	# projects matching $projname/*.git will not be shown in the main
 	# projects list, instead a '+' mark will be added to $projname
 	# there and a 'forks' view will be enabled for the project, listing
-	# all the forks. This feature is supported only if project list
-	# is taken from a directory, not file.
+	# all the forks. If project list is taken from a file, forks have
+	# to be listed after the main project.
 
 	# To enable system wide have in $GITWEB_CONFIG
 	# $feature{'forks'}{'default'} = [1];
@@ -1047,6 +1047,8 @@ sub git_get_projects_list {
 	$filter ||= '';
 	$filter =~ s/\.git$//;
 
+	my ($check_forks) = gitweb_check_feature('forks');
+
 	if (-d $projects_list) {
 		# search in directory
 		my $dir = $projects_list . ($filter ? "/$filter" : '');
@@ -1054,8 +1056,6 @@ sub git_get_projects_list {
 		$dir =~ s!/+$!!;
 		my $pfxlen = length("$dir");
 
-		my ($check_forks) = gitweb_check_feature('forks');
-
 		File::Find::find({
 			follow_fast => 1, # follow symbolic links
 			dangling_symlinks => 0, # ignore dangling symlinks, silently
@@ -1081,7 +1081,9 @@ sub git_get_projects_list {
 		# 'git%2Fgit.git Linus+Torvalds'
 		# 'libs%2Fklibc%2Fklibc.git H.+Peter+Anvin'
 		# 'linux%2Fhotplug%2Fudev.git Greg+Kroah-Hartman'
+		my %paths;
 		open my ($fd), $projects_list or return;
+	PROJECT:
 		while (my $line = <$fd>) {
 ...
Previous thread: [PATCH 5/5] cvsimport: Improve formating consistency by Frank Lichtenheld on Friday, April 6, 2007 - 2:52 pm. (1 message)

Next thread: [PATCH(resend)] gitweb: Allow configuring the default projects order and add order 'none' by Frank Lichtenheld on Friday, April 6, 2007 - 2:58 pm. (3 messages)