@matheusbsbs / matheus-bagliano / commits / 20e7ab8ae2
Fork 0

git-instaweb: Change how gitweb.psgi is made runnable as standalone app

According to blog post "FindBin, __FILE__, $0 and PSGI woes" http://bulknews.typepad.com/blog/2011/02/findbin-__file__-0-and-psgi-woes.html by Tatsuhiko Miyagawa, using 'if (__FILE__ eq $0)' in .psgi code (to check if script was run from command line), is not supposed to work since Plack 0.9971. Replace it with one of proposed solutions; while at it return $app explicitely, rather than implicitely by being a last expression. This affects 'plackup' web server. While at it cleanup whitespace. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Feb 26, 2011 at 23:32 UTC 20e7ab8ae26108e1d8675c375be7f06820da5cb0
1 file changed +4 -2
git-instaweb.sh
+4 -2
@@ -558,12 +558,14 @@ my \$app = builder {
558
559 # make it runnable as standalone app,
560 # like it would be run via 'plackup' utility
561 -if (__FILE__ eq \$0) {
561 +if (caller) {
562 + return \$app;
563 +} else {
564 require Plack::Runner;
565
566 my \$runner = Plack::Runner->new();
567 \$runner->parse_options(qw(--env deployment --port $port),
566 - "$local" ? qw(--host 127.0.0.1) : ());
568 + "$local" ? qw(--host 127.0.0.1) : ());
569 \$runner->run(\$app);
570 }
571 __END__