Subject: Re: [PATCHv2] gitweb: selectable configurations that change with each request

From: Jonathan Nieder <[email-masked]>
Date: Thu, 25 Nov 2010 12:23:14 -0600

Jakub Narebski wrote:

> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
[...]
> @@ -1068,12 +1076,21 @@ sub reset_timer {
>  	our $number_of_git_cmds = 0;
>  }
>  
> +our $first_request = 1;
>  sub run_request {
>  	reset_timer();
>  
>  	evaluate_uri();
> -	evaluate_gitweb_config();
> -	evaluate_git_version();
> +	if ($first_request) {
> +		evaluate_gitweb_config();
> +		evaluate_git_version();
> +	} elsif ($per_request_config) {
> +		if (ref($per_request_config) eq 'CODE') {
> +			$per_request_config->();
> +		} else {
> +			evaluate_gitweb_config();
> +		}
> +	}

Should per_request_config() be run for the first request, too?  Maybe:

	if ($first_request) {
		evaluate_gitweb_config();
		evaluate_git_version();
	}
	if ($per_request_config) {
		if (ref($per_request_config) eq 'CODE') {
			$per_request_config->();
		} elsif (!$first_request) {
			evaluate_gitweb_config();
		}
	}