gitweb: Return or exit after done serving request
Check if there is a caller in top frame of gitweb, and either 'return' if gitweb code is wrapped in subroutine, or 'exit' if it is not. This should avoid gitweb.cgi: Subroutine git_SOMETHING redefined at gitweb.cgi line NNN warnings in error_log when running gitweb with mod_perl (using ModPerl::Registry handler) Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
Jun 13, 2010 at 12:09 UTC
5ed2ec1041b6aeec81b0f0a9775355a9b2c755a6
1 file changed
+9
-1
gitweb/gitweb.perl
+9
-1
@@ -1000,8 +1000,16 @@ if ($action !~ m/^(?:opml|project_list|project_index)$/ &&
1000
die_error(400, "Project needed");
1001
}
1002
$actions{$action}->();
1003
+
1004
DONE_GITWEB:
1004
-1;
1005
+if (defined caller) {
1006
+ # wrapped in a subroutine processing requests,
1007
+ # e.g. mod_perl with ModPerl::Registry, or PSGI with Plack::App::WrapCGI
1008
+ return;
1009
+} else {
1010
+ # pure CGI script, serving single request
1011
+ exit;
1012
+}
1013
1014
## ======================================================================
1015
## action links