summaryrefslogtreecommitdiff
path: root/git-instaweb.sh
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2011-02-26 22:32:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-02-28 06:02:31 (GMT)
commit20e7ab8ae26108e1d8675c375be7f06820da5cb0 (patch)
tree795228f3106c6016982254193a75772f70e193ff /git-instaweb.sh
parent62270f6b0a4e67e5044fb0d70d0e82ac6e553eb2 (diff)
downloadgit-20e7ab8ae26108e1d8675c375be7f06820da5cb0.zip
git-20e7ab8ae26108e1d8675c375be7f06820da5cb0.tar.gz
git-20e7ab8ae26108e1d8675c375be7f06820da5cb0.tar.bz2
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>
Diffstat (limited to 'git-instaweb.sh')
-rwxr-xr-xgit-instaweb.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 10fcebb..8bfa8a0 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -558,12 +558,14 @@ my \$app = builder {
# make it runnable as standalone app,
# like it would be run via 'plackup' utility
-if (__FILE__ eq \$0) {
+if (caller) {
+ return \$app;
+} else {
require Plack::Runner;
my \$runner = Plack::Runner->new();
\$runner->parse_options(qw(--env deployment --port $port),
- "$local" ? qw(--host 127.0.0.1) : ());
+ "$local" ? qw(--host 127.0.0.1) : ());
\$runner->run(\$app);
}
__END__