gitweb: Silence 'Variable VAR may be unavailable' warnings
authorJakub Narebski <jnareb@gmail.com>
Fri, 30 Apr 2010 16:30:31 +0000 (18:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 1 May 2010 19:40:12 +0000 (12:40 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl

index 48e21dad6cec580cd874e32e981a86dc909893f7..64eaa759966c5992c5c2ab6f8e663e109a0e2cc8 100755 (executable)
@@ -1520,6 +1520,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