]> Lady’s Gitweb - Gitweb/commit
gitweb: selectable configurations that change with each request
authorJakub Narebski <redacted>
Thu, 25 Nov 2010 18:43:59 +0000 (19:43 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:30 +0000 (00:51 -0400)
commitf39914961c793a5e8a8be7ee48f4476cb20057723a367980e73c5d6e5a4ab039
treec844fbab582c0d0731f0c47b2e29768a18b5999d82fbf996f80bc4562d54f539
parent32ef75f7743dabed70d82292e1c96158bb90b054f0539cbf32ddb84da7d7c335
gitweb: selectable configurations that change with each request

Allow selecting whether configuration file should be (re)parsed on each
request (the default, for backward compatibility with configurations that
change per session, see commit 7f425db (gitweb: allow configurations that
change with each request, 2010-07-30)), or whether should it be parsed only
once (for performance speedup for persistent environments, though currently
only FastCGI is able to make use of it, when flexibility is not important).

You can also have configuration file parsed only once, but have parts of
configuration (re)evaluated once per each request.

This is done by introducing $per_request_config variable: if set to code
reference, this code would be run once per request, while config file would
be parsed only once.  For example gitolite's contrib/gitweb/gitweb.conf
fragment mentioned in 7f425db could be rewritten as

  our $per_request_config = sub {
   $ENV{GL_USER} = ($cgi && $cgi->remote_user) || "gitweb";
  };

to make use of this feature.

If $per_request_config is not a code reference, it is taken to be boolean
variable, to choose between running config file for each request
(flexibility), and running config file only once (performance in
persistent environments).

The default value for $per_request_config is 1 (true), which means that
old configuration that require to change per session (like gitolite's)
will keep working.

While at it, make it so evaluate_git_version() is run only once.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
README
gitweb.perl
This page took 0.226244 seconds and 4 git commands to generate.