Subject: Re: [RFD] Gitweb: Source configuration from file separate from the CGI script

From: Jakub Narebski <[email-masked]>
Date: Thu, 17 Mar 2011 03:21:48 -0700 (PDT)

Drew Northup <[email-masked]> writes:
> On Wed, 2011-03-16 at 09:34 -0500, Jonathan Nieder wrote:
> > Drew Northup wrote:
> > 
> > > I just upgraded my Gitweb package (I'm testing the EPEL RHEL5 latest;
> > > I'm not too happy with them tweaking the paths) and as I should have
> > > expected all of my Gitweb configuration is now gone.

We discourage configuring gitweb by editing generated gitweb.cgi file
for a long, long time, at least since v1.4.2-rc2-102-gc8d138a (gitweb:
optionally read config from GITWEB_CONFIG, 2006-08-02).  It is
described in gitweb/README since v1.4.3-rc1-7-g45a3b12 (gitweb:
Document features better, 2006-10-07).

> > In gitweb/README, I see:

Not only gitweb/README; in gitweb.cgi that you are, I suppose,
editing, you have $GITWEB_CONFIG mentioned 25 times as a place
to override default configuration.

> > 
> > | You can adjust gitweb behaviour using the file specified in `GITWEB_CONFIG`
> > | (defaults to 'gitweb_config.perl' in the same directory as the CGI), and
> > | as a fallback `GITWEB_CONFIG_SYSTEM` (defaults to /etc/gitweb.conf).
> 
> I apparently missed that. Alas, I didn't see it in the code when I was
> setting my values so I assumed that it wasn't available.

$GITWEB_CONFIG is mentioned 25 times in gitweb source; is it not enough?

> Perhaps we can make this a little more obvious?

How can we make it more obvious?  gitweb/INSTALL has "Build time
configuration" just below instruction on how to build it, and it
mentions "How to configure gitweb for your local system" section in
gitweb/README in very first line of this section.

> I'll go try that out and see if I can make it break--putting it in
> the same directory definitely wouldn't have helped this time.

First, as Jonathan cited, you can by default beside
'gitweb_config.perl' in the same directory as the CGI use '
/etc/gitweb.conf' file.

Second, you can configure where GITWEB_CONFIG and GITWEB_CONFIG_SYSTEM
are to be found dusing build time, e.g.

  $ make GITWEB_CONFIG_SYSTEM=/etc/gitweb/gitweb_config.perl \
         install-gitweb

Third, you can override where gitweb searches for its config files
using GITWEB_CONFIG and/or GITWEB_CONFIG_SYSTEM configuration
variables; quite useful for debugging gitweb, and for gitweb tests in
git.git repository.

-- 
Jakub Narebski
Poland
ShadeHawk on #git