@matheusbsbs / matheus-bagliano / commits / 8d2dbbac21
Fork 0

gitweb: fix 'ctags' feature check and others

gitweb_check_feature() function is to retrieve the configuration parameter list and calling it in the scalar context does not give its first element that tells if the feature is enabled. This fixes all the existing callers to call the function correctly in the list context. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 29, 2008 at 12:53 UTC 8d2dbbac21bbb76af29133331e2a88870d93899d
1 file changed +7 -7
gitweb/gitweb.perl
+7 -7
@@ -3914,7 +3914,7 @@ sub fill_project_list_info {
3914 my ($projlist, $check_forks) = @_;
3915 my @projects;
3916
3917 - my $show_ctags = gitweb_check_feature('ctags');
3917 + my ($show_ctags) = gitweb_check_feature('ctags');
3918 PROJECT:
3919 foreach my $pr (@$projlist) {
3920 my (@activity) = git_get_last_activity($pr->{'path'});
@@ -3988,7 +3988,7 @@ sub git_project_list_body {
3988 @projects = sort {$a->{$oi->{'key'}} <=> $b->{$oi->{'key'}}} @projects;
3989 }
3990
3991 - my $show_ctags = gitweb_check_feature('ctags');
3991 + my ($show_ctags) = gitweb_check_feature('ctags');
3992 if ($show_ctags) {
3993 my %ctags;
3994 foreach my $p (@projects) {
@@ -4457,7 +4457,7 @@ sub git_summary {
4457 }
4458
4459 # Tag cloud
4460 - my $show_ctags = (gitweb_check_feature('ctags'))[0];
4460 + my ($show_ctags) = gitweb_check_feature('ctags');
4461 if ($show_ctags) {
4462 my $ctags = git_get_project_ctags($project);
4463 my $cloud = git_populate_project_tagcloud($ctags);
@@ -4559,7 +4559,7 @@ sub git_blame {
4559 my $fd;
4560 my $ftype;
4561
4562 - gitweb_check_feature('blame')
4562 + gitweb_check_feature('blame')[0]
4563 or die_error(403, "Blame view not allowed");
4564
4565 die_error(400, "No file name given") unless $file_name;
@@ -5610,7 +5610,7 @@ sub git_history {
5610 }
5611
5612 sub git_search {
5613 - gitweb_check_feature('search') or die_error(403, "Search is disabled");
5613 + gitweb_check_feature('search')[0] or die_error(403, "Search is disabled");
5614 if (!defined $searchtext) {
5615 die_error(400, "Text field is empty");
5616 }
@@ -5629,11 +5629,11 @@ sub git_search {
5629 if ($searchtype eq 'pickaxe') {
5630 # pickaxe may take all resources of your box and run for several minutes
5631 # with every query - so decide by yourself how public you make this feature
5632 - gitweb_check_feature('pickaxe')
5632 + gitweb_check_feature('pickaxe')[0]
5633 or die_error(403, "Pickaxe is disabled");
5634 }
5635 if ($searchtype eq 'grep') {
5636 - gitweb_check_feature('grep')
5636 + gitweb_check_feature('grep')[0]
5637 or die_error(403, "Grep is disabled");
5638 }
5639