From 305a10339b33d56b4a50708d71e8f42453c8cb1f Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Mon, 6 Dec 2010 00:01:09 +0100 Subject: [PATCH] gitweb: Introduce %actions_info, gathering information about actions Currently it only contains information about output format, and is not used anywhere. It will be used to check whether current action produces HTML output, and therefore is displaying HTML-based progress info about (re)generating cache makes sense. It can contain information about allowed extra options, whether to display link to feed (Atom or RSS), etc. in easier and faster way than listing all matching or all non-matching actions at appropriate place. Currently not used; will be used in next commit, to check if action produces HTML output and therefore we can use HTML-specific progress indicator. Signed-off-by: Jakub Narebski --- gitweb/gitweb.perl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index c5ba1d4f1e..32376346ca 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -818,6 +818,25 @@ our %allowed_options = ( "--no-merges" => [ qw(rss atom log shortlog history) ], ); +our %actions_info = (); +sub evaluate_actions_info { + our %actions_info; + our (%actions); + + # unless explicitely stated otherwise, default output format is html + foreach my $action (keys %actions) { + $actions_info{$action}{'output_format'} = 'html'; + } + # list all exceptions; undef means variable (no definite format) + map { $actions_info{$_}{'output_format'} = 'text' } + qw(commitdiff_plain patch patches project_index blame_data); + map { $actions_info{$_}{'output_format'} = 'xml' } + qw(rss atom opml); # there are different types (document formats) of XML + map { $actions_info{$_}{'output_format'} = undef } + qw(blob_plain object); + $actions_info{'snapshot'}{'output_format'} = 'binary'; +} + # fill %input_params with the CGI parameters. All values except for 'opt' # should be single values, but opt can be an array. We should probably # build an array of parameters that can be multi-valued, but since for the time @@ -1226,6 +1245,7 @@ sub evaluate_argv { sub run { evaluate_argv(); + evaluate_actions_info(); $pre_listen_hook->() if $pre_listen_hook; -- 2.11.4.GIT