* [PATCH] gitweb: Silence 'Variable VAR may be unavailable' warnings
@ 2010-04-30 16:30 Jakub Narebski
0 siblings, 0 replies; only message in thread
From: Jakub Narebski @ 2010-04-30 16:30 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
When $projects_list points to a directory, and git_get_projects_list
scans this directory for repositories, there can be generated the
following warnings (for persistent services like mod_perl or plackup):
Variable "$project_maxdepth" may be unavailable at gitweb.cgi line 2443.
Variable "$projectroot" may be unavailable at gitweb.cgi line 2451.
Those are false positives; silence those warnings by explicitely
declaring $project_maxdepth and $projectroot with 'our', as global
variables, in anonymous subrotine passed to File::Find::find.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Those warnings do not appear when run as simple CGI script, so test
suite could not catch them.
gitweb/gitweb.perl | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7d9b660..d6cbfa9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2433,6 +2433,9 @@ sub git_get_projects_list {
follow_skip => 2, # ignore duplicates
dangling_symlinks => 0, # ignore dangling symlinks, silently
wanted => sub {
+ # global variables
+ our $project_maxdepth;
+ our $projectroot;
# skip project-list toplevel, if we get it.
return if (m!^[/.]$!);
# only directories can be git repositories
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-04-30 19:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-30 16:30 [PATCH] gitweb: Silence 'Variable VAR may be unavailable' warnings Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).