From: Junio C Hamano Date: Fri, 5 Mar 2010 06:27:12 +0000 (-0800) Subject: Merge branch 'jn/gitweb-config-error-die' into maint X-Git-Tag: v1.7.0.2~5 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7d181222ea568ada9952f23a8f92b35bce161cc2?ds=inline;hp=-c Merge branch 'jn/gitweb-config-error-die' into maint * jn/gitweb-config-error-die: gitweb: Die if there are parsing errors in config file --- 7d181222ea568ada9952f23a8f92b35bce161cc2 diff --combined gitweb/gitweb.perl index 0b1e357ce9,20106a4f42..3d80deba01 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@@ -454,11 -454,7 +454,11 @@@ sub gitweb_get_feature $feature{$name}{'sub'}, $feature{$name}{'override'}, @{$feature{$name}{'default'}}); - if (!$override) { return @defaults; } + # project specific override is possible only if we have project + our $git_dir; # global variable, declared later + if (!$override || !defined $git_dir) { + return @defaults; + } if (!defined $sub) { warn "feature $name is not overridable"; return @defaults; @@@ -554,11 -550,14 +554,14 @@@ sub filter_snapshot_fmts } our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++"; + our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++"; + # die if there are errors parsing config file if (-e $GITWEB_CONFIG) { do $GITWEB_CONFIG; - } else { - our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++"; - do $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM; + die $@ if $@; + } elsif (-e $GITWEB_CONFIG_SYSTEM) { + do $GITWEB_CONFIG_SYSTEM; + die $@ if $@; } # Get loadavg of system, to compare against $maxload. @@@ -2206,9 -2205,6 +2209,9 @@@ sub config_to_multi sub git_get_project_config { my ($key, $type) = @_; + # do we have project + return unless (defined $project && defined $git_dir); + # key sanity check return unless ($key); $key =~ s/^gitweb\.//;