summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorLibravatar Jakub Narebski <jnareb@gmail.com>2006-08-22 16:59:20 +0200
committerLibravatar Junio C Hamano <junkio@cox.net>2006-08-22 16:06:31 -0700
commit77a153fd92ae6e4e40e0ccb15c9f808d63e198a0 (patch)
treef22c3e806d5ef66013fd598d23c0cb8a07350ef7 /gitweb
parentgitweb: Use underscore instead of hyphen to separate words in HTTP headers names (diff)
downloadtgif-77a153fd92ae6e4e40e0ccb15c9f808d63e198a0.tar.xz
gitweb: Route rest of action subroutines through %actions
Route rest of action subroutines, namely git_project_list and git_opml (both of which doesn't need $project) through %actions hash. This has disadvantage that all parameters are read and validated; earlier git_opml was called as soon as $action was parsed and validated, git_project_list was called as soon as $project was parsed and validated. This has advantage that all action dispatch is grouped in one place. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl17
1 files changed, 8 insertions, 9 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c4a4f7ffd7..ae38eca03e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -155,11 +155,6 @@ if (defined $action) {
if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
die_error(undef, "Invalid action parameter");
}
- # action which does not check rest of parameters
- if ($action eq "opml") {
- git_opml();
- exit;
- }
}
our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
@@ -179,9 +174,6 @@ if (defined $project) {
die_error(undef, "No such project");
}
$ENV{'GIT_DIR'} = "$projectroot/$project";
-} else {
- git_project_list();
- exit;
}
our $file_name = $cgi->param('f');
@@ -255,9 +247,16 @@ my %actions = (
"tags" => \&git_tags,
"tree" => \&git_tree,
"snapshot" => \&git_snapshot,
+ # those below don't need $project
+ "opml" => \&git_opml,
+ "project_list" => \&git_project_list,
);
-$action = 'summary' if (!defined($action));
+if (defined $project) {
+ $action ||= 'summary';
+} else {
+ $action ||= 'project_list';
+}
if (!defined($actions{$action})) {
die_error(undef, "Unknown action");
}