git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv3 2/2 (version B)] gitweb: Use /etc/gitweb.conf even if gitweb_conf.perl exist

From
Junio C Hamano <gitster@pobox.com>
Date
May 25, 2011, 18:54 UTC
Message-ID
<7v8vtu4nmy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1306341328-11108-4-git-send-email-jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 5 quoted lines
> This commit should be thought as exclusive to
>
>   [PATCH 2/2 (version A)] gitweb: Mention read_config_file in gitweb/README
>
> We have to choose one or the other.
Who says?  We do not have to.  Why not do this instead?
	our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} ||
		"/etc/gitweb-common.conf";
	# common system-wide settings for convenience
        read_config_file($GITWEB_COMMON);
        # as always, use the per-instance GITWEB_CONFIG if exists,
        # otherwise use GITWEB_SYSTEM_CONFIG
        read_config_file($GITWEB_CONFIG) ||
        	read_config_file($GITWEB_CONFIG_SYSTEM);

There is no risk of hurting any existing installations, and people who do have things that needs to be shared do not have to go around and update all the per-instance configuration files.

 diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
Show 16 quoted lines
> index ce92d67..e4b0932 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -656,9 +656,10 @@ sub evaluate_gitweb_config {
>  	our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
>  	our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
>  
> -	# use first config file that exists
> -	read_config_file($GITWEB_CONFIG) or
> +	# let settings in second override ones in first
>  	read_config_file($GITWEB_CONFIG_SYSTEM);
> +	read_config_file($GITWEB_CONFIG)
> +		if ($GITWEB_CONFIG ne $GITWEB_CONFIG_SYSTEM);
>  }
>  
>  # Get loadavg of system, to compare against $maxload.
Previous: Jakub NarebskiNext: Jakub Narebski
Message 6 of 9 in “gitweb: Improve handling of configuration files”
  1. 0/2 gitweb: Improve handling of configuration filesJakub Narebski, May 25, 2011
  2. 1/2 gitweb: Refactor reading and parsing config file into read_config_fileJakub Narebski, May 25, 2011
  3. Junio C HamanoMay 25, 2011
  4. 2/2 gitweb: Mention read_config_file in gitweb/READMEJakub Narebski, May 25, 2011
  5. 2/2 gitweb: Use /etc/gitweb.conf even if gitweb_conf.perl existJakub Narebski, May 25, 2011
  6. Junio C HamanoMay 25, 2011
  7. 2/2 gitweb: Introduce common system-wide settings for convenienceJakub Narebski, May 26, 2011
  8. J.H.May 25, 2011
  9. Junio C HamanoMay 25, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.