gitweb: use a hash to lookup the sub for an action
Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
717b831178
commit
8e85cdc4ef
@ -161,65 +161,34 @@ if (defined $searchtext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# dispatch
|
# dispatch
|
||||||
if (!defined $action || $action eq "summary") {
|
my %actions = (
|
||||||
git_summary();
|
"blame" => \&git_blame2,
|
||||||
exit;
|
"blobdiff" => \&git_blobdiff,
|
||||||
} elsif ($action eq "heads") {
|
"blobdiff_plain" => \&git_blobdiff_plain,
|
||||||
git_heads();
|
"blob" => \&git_blob,
|
||||||
exit;
|
"blob_plain" => \&git_blob_plain,
|
||||||
} elsif ($action eq "tags") {
|
"commitdiff" => \&git_commitdiff,
|
||||||
git_tags();
|
"commitdiff_plain" => \&git_commitdiff_plain,
|
||||||
exit;
|
"commit" => \&git_commit,
|
||||||
} elsif ($action eq "blob") {
|
"heads" => \&git_heads,
|
||||||
git_blob();
|
"history" => \&git_history,
|
||||||
exit;
|
"log" => \&git_log,
|
||||||
} elsif ($action eq "blob_plain") {
|
"rss" => \&git_rss,
|
||||||
git_blob_plain();
|
"search" => \&git_search,
|
||||||
exit;
|
"shortlog" => \&git_shortlog,
|
||||||
} elsif ($action eq "tree") {
|
"summary" => \&git_summary,
|
||||||
git_tree();
|
"tag" => \&git_tag,
|
||||||
exit;
|
"tags" => \&git_tags,
|
||||||
} elsif ($action eq "rss") {
|
"tree" => \&git_tree,
|
||||||
git_rss();
|
);
|
||||||
exit;
|
|
||||||
} elsif ($action eq "commit") {
|
$action = 'summary' if (!defined($action));
|
||||||
git_commit();
|
if (!defined($actions{$action})) {
|
||||||
exit;
|
|
||||||
} elsif ($action eq "log") {
|
|
||||||
git_log();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "blobdiff") {
|
|
||||||
git_blobdiff();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "blobdiff_plain") {
|
|
||||||
git_blobdiff_plain();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "commitdiff") {
|
|
||||||
git_commitdiff();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "commitdiff_plain") {
|
|
||||||
git_commitdiff_plain();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "history") {
|
|
||||||
git_history();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "search") {
|
|
||||||
git_search();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "shortlog") {
|
|
||||||
git_shortlog();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "tag") {
|
|
||||||
git_tag();
|
|
||||||
exit;
|
|
||||||
} elsif ($action eq "blame") {
|
|
||||||
git_blame2();
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
undef $action;
|
undef $action;
|
||||||
die_error(undef, "Unknown action.");
|
die_error(undef, "Unknown action.");
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
$actions{$action}->();
|
||||||
|
exit;
|
||||||
|
|
||||||
## ======================================================================
|
## ======================================================================
|
||||||
## validation, quoting/unquoting and escaping
|
## validation, quoting/unquoting and escaping
|
||||||
|
Loading…
Reference in New Issue
Block a user