Skip to content

Commit ee1d8ee

Browse files
jnarebgitster
authored andcommitted
gitweb: Silence 'Variable VAR may be unavailable' warnings
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ca5e949 commit ee1d8ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gitweb/gitweb.perl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,9 @@ sub git_get_projects_list {
15201520
follow_skip => 2, # ignore duplicates
15211521
dangling_symlinks => 0, # ignore dangling symlinks, silently
15221522
wanted => sub {
1523+
# global variables
1524+
our $project_maxdepth;
1525+
our $projectroot;
15231526
# skip project-list toplevel, if we get it.
15241527
return if (m!^[/.]$!);
15251528
# only directories can be git repositories

0 commit comments

Comments
 (0)