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

[PATCH] gitweb: require $ENV{'GITWEB_CONFIG'}

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Aug 2, 2006, 20:29 UTC
Message-ID
<E1G8NLU-0006TL-J7@moooo.ath.cx>
In-Reply-To
<20060802192333.GA30861@coredump.intra.peff.net>
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
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 
./run p=git/.git > /dev/null  0.47s user 0.58s system 102% cpu 1.025
total

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.
---
 gitweb/README      |    5 +++++
 gitweb/gitweb.perl |    4 ++++
 2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gitweb/README b/gitweb/README
index b91d42a..dc4b850 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -23,6 +23,11 @@ You can specify the following configurat
    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 additionally (after) the file
+   specified when gitweb.cgi was created.
 
 Originally written by:
   Kay Sievers <kay.sievers@vrfy.org>
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f4c0d87..efcc926 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -63,6 +63,10 @@ our $mimetypes_file = undef;
 our $GITWEB_CONFIG = '@@GITWEB_CONFIG@@';
 require $GITWEB_CONFIG if -e $GITWEB_CONFIG;
 
+if (defined($ENV{'GITWEB_CONFIG'}) && -e $ENV{'GITWEB_CONFIG'}) {
+	require $ENV{'GITWEB_CONFIG'};
+}
+
 # version of the core git binary
 our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
 
-- 
1.4.2.rc2.g4713
Previous: Junio C HamanoNext: Jeff King
Message 11 of 16 in “gitweb: optionally read config from GITWEB_CONFIG”
  1. gitweb: optionally read config from GITWEB_CONFIGJeff King, Aug 2, 2006
  2. gitweb: use single quotes for values replaced by the MakefileMatthias Lederhofer, Aug 2, 2006
  3. Junio C HamanoAug 2, 2006
  4. Matthias LederhoferAug 2, 2006
  5. Jeff KingAug 2, 2006
  6. Jakub NarebskiAug 2, 2006
  7. Matthias LederhoferAug 2, 2006
  8. Jakub NarebskiAug 2, 2006
  9. Jeff KingAug 2, 2006
  10. Junio C HamanoAug 2, 2006
  11. gitweb: require $ENV{'GITWEB_CONFIG'}Matthias Lederhofer, Aug 2, 2006
  12. Jeff KingAug 2, 2006
  13. Junio C HamanoAug 2, 2006
  14. Jeff KingAug 2, 2006
  15. Luben TuikovAug 2, 2006
  16. Jeff KingAug 2, 2006

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.