{"thread":{"id":"5442","subject":"[PATCH] gitweb: Add git_project_index for generating index.aux","startedAt":"2006-08-31T13:17:11Z","lastAt":"2006-08-31T14:33:05Z","messageCount":2,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"26144","messageId":"200608311517.11987.jnareb@gmail.com","threadId":"5442","inReplyTo":null,"subject":"[PATCH] gitweb: Add git_project_index for generating index.aux","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-31T13:17:11Z","receivedAt":"2006-08-31T13:17:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Add git_project_index, which generates index.aux file that can be used\nas a source of projects list, instead of generating projects list from\na directory.  Using file as a source of projects list allows for some\nprojects to be not present in gitweb main (project_list) page, and/or\ncorrect project owner info.\n\nThis also allows for easy getting list of all available (well, gitweb\navailable) projects. OPML output offers something similar.\n\nThis action is not linked from anywhere, one must put p=project_index\ninto query string by hand.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   25 +++++++++++++++++++++++++\n 1 files changed, 25 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex fa7f62a..98193be 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -268,6 +268,7 @@ my %actions = (\n \t# those below don't need $project\n \t\"opml\" => \\&git_opml,\n \t\"project_list\" => \\&git_project_list,\n+\t\"project_index\" => \\&git_project_index,\n );\n \n if (defined $project) {\n@@ -2069,6 +2070,30 @@ sub git_project_list {\n \tgit_footer_html();\n }\n \n+sub git_project_index {\n+\tmy @projects = git_get_projects_list();\n+\n+\tprint $cgi->header(\n+\t\t-type => 'text/plain',\n+\t\t-charset => 'utf-8',\n+\t\t-content_disposition => qq(inline; filename=\"index.aux\"));\n+\n+\tforeach my $pr (@projects) {\n+\t\tif (!exists $pr->{'owner'}) {\n+\t\t\t$pr->{'owner'} = get_file_owner(\"$projectroot/$project\");\n+\t\t}\n+\n+\t\tmy ($path, $owner) = ($pr->{'path'}, $pr->{'owner'});\n+\t\t# quote as in CGI::Util::encode, but keep the slash, and use '+' for ' '\n+\t\t$path  =~ s/([^a-zA-Z0-9_.\\-\\/ ])/sprintf(\"%%%02X\", ord($1))/eg;\n+\t\t$owner =~ s/([^a-zA-Z0-9_.\\-\\/ ])/sprintf(\"%%%02X\", ord($1))/eg;\n+\t\t$path  =~ s/ /\\+/g;\n+\t\t$owner  =~ s/ /\\+/g;\n+\n+\t\tprint \"$path $owner\\n\";\n+\t}\n+}\n+\n sub git_summary {\n \tmy $descr = git_get_project_description($project) || \"none\";\n \tmy $head = git_get_head_hash($project);\n-- \n1.4.1.1\n"},{"id":"26145","messageId":"ed6rv1$3q1$1@sea.gmane.org","threadId":"5442","inReplyTo":"200608311517.11987.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Add git_project_index for generating index.aux","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-31T14:33:05Z","receivedAt":"2006-08-31T14:33:05Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jakub Narebski wrote:\n\n> This action is not linked from anywhere, one must put p=project_index\n> into query string by hand.\n\nOf course it should be a=project_index (or rather ?a=project_index).\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}