Subject: Re: [PATCH 07/18] gitweb: Revert back to $cache_enable vs. $caching_enabled

From: Jakub Narebski <[email-masked]>
Date: Thu, 09 Dec 2010 15:38:01 -0800 (PST)

"John 'Warthog9' Hawley" <[email-masked]> writes:

> Simple enough, $cache_enable (along with all caching variables) are
> already in production in multiple places and doing a small semantic
> change without backwards compatibility is pointless breakage.

Formally, there is no backward compatibility with any released code.
Using out-of-tree patches is on one's own risk.

But even discarding that, I'd rather use the same solution as in

  [PATCHv6/RFC 22/24] gitweb: Support legacy options used by kernel.org caching engine
  http://thread.gmane.org/gmane.comp.version-control.git/163052/focus=163058
  http://repo.or.cz/w/git/jnareb-git.git/commitdiff/27ec67ad90ecd56ac3d05f6a9ea49b6faabf7d0a

i.e.

  our $cache_enable;

  [...]

  # somewhere just before call to cache_fetch()
  $caching_enabled = !!$cache_enable if defined $cache_enable;

> 
> This reverts back to the previous variable to enable / disable caching

[...]
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -258,7 +258,7 @@ our $maxload = 300;
>  # that the cache directory be periodically completely deleted, and this is safe to perform.
>  # Suggested mechanism
>  # mv $cacheidr $cachedir.flush;mkdir $cachedir;rm -rf $cachedir.flush
> -our $caching_enabled = 0;
> +our $cache_enable = 0;
>  
>  # Used to set the minimum cache timeout for the dynamic caching algorithm.  Basically
>  # if we calculate the cache to be under this number of seconds we set the cache timeout
> @@ -1138,7 +1138,7 @@ sub dispatch {
>  	    !$project) {
>  		die_error(400, "Project needed");
>  	}
> -	if ($caching_enabled && is_cacheable($action)) {
> +	if ($cache_enable && is_cacheable($action)) {
>  		cache_fetch($action);
>  	} else {
>  		$actions{$action}->();

-- 
Jakub Narebski
Poland
ShadeHawk on #git