Skip to content

Commit

Permalink
gitweb: Return or exit after done serving request
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Jun 14, 2010
1 parent a5080d8 commit 5ed2ec1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,16 @@ sub handle_errors_html {
die_error(400, "Project needed");
}
$actions{$action}->();

DONE_GITWEB:
1;
if (defined caller) {
# wrapped in a subroutine processing requests,
# e.g. mod_perl with ModPerl::Registry, or PSGI with Plack::App::WrapCGI
return;
} else {
# pure CGI script, serving single request
exit;
}

## ======================================================================
## action links
Expand Down

0 comments on commit 5ed2ec1

Please sign in to comment.