From bb55f77fcd0748e0faf152a565eef65b2066cfb4 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Wed, 2 Aug 2006 22:29:36 +0200 Subject: [PATCH] gitweb: require $ENV{'GITWEB_CONFIG'} With this patch it is possible to use gitweb.perl for developing by loading the configuration from $GITWEB_CONFIG. This might also be useful for normal usage of gitweb. Example: % cat cfg $GIT = '/usr/bin/git'; $projectroot = '/home/matled/src/git'; $projects_list = '/home/matled/src/git/git/gitweb/list'; % cat run #!/bin/sh export GATEWAY_INTERFACE="CGI/1.1" export HTTP_ACCEPT="*/*" export REQUEST_METHOD="GET" export GITWEB_CONFIG='./cfg' export QUERY_STRING=""$1"" exec ./gitweb.perl % time ./run p=git/.git > /dev/null This makes it easy to check for warnings and do performance tests after changes, you can also pipe this to lynx -dump -force-html /dev/stdin to get more than just html. This also documents the original patch adding require $GITWEB_CONFIG. Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- gitweb/README | 5 +++++ gitweb/gitweb.perl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gitweb/README b/gitweb/README index b91d42a90..27c6dac14 100644 --- a/gitweb/README +++ b/gitweb/README @@ -23,6 +23,11 @@ You can specify the following configuration variables when building GIT: Points to the location where you put gitweb.css on your web server. * GITWEB_LOGO Points to the location where you put git-logo.png on your web server. + * GITWEB_CONFIG + This file will be loaded using 'require'. If the environment + $GITWEB_CONFIG is set when gitweb.cgi is executed the file in the + environment variable will be loaded instead of the file + specified when gitweb.cgi was created. Originally written by: Kay Sievers diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index d5b2de8b3..b5548ec8f 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -60,7 +60,7 @@ our $default_text_plain_charset = undef; # (relative to the current git repository) our $mimetypes_file = undef; -our $GITWEB_CONFIG = "@@GITWEB_CONFIG@@"; +our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@@GITWEB_CONFIG@@"; require $GITWEB_CONFIG if -e $GITWEB_CONFIG; # version of the core git binary -- 2.45.2