Git development
 help / color / mirror / Atom feed
From: Matthias Lederhofer <matled@gmx.net>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: [PATCH] gitweb: require $ENV{'GITWEB_CONFIG'}
Date: Wed, 2 Aug 2006 22:29:36 +0200	[thread overview]
Message-ID: <E1G8NLU-0006TL-J7@moooo.ath.cx> (raw)
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

  parent reply	other threads:[~2006-08-02 20:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-02 19:23 [PATCH] gitweb: optionally read config from GITWEB_CONFIG Jeff King
2006-08-02 20:17 ` [PATCH] gitweb: use single quotes for values replaced by the Makefile Matthias Lederhofer
2006-08-02 20:50   ` Junio C Hamano
2006-08-02 20:57     ` Matthias Lederhofer
2006-08-02 20:58     ` Jeff King
2006-08-02 20:21 ` [PATCH] gitweb: optionally read config from GITWEB_CONFIG Jakub Narebski
2006-08-02 20:31   ` Matthias Lederhofer
2006-08-02 20:36     ` Jakub Narebski
2006-08-02 20:41   ` Jeff King
2006-08-02 20:28 ` Junio C Hamano
2006-08-02 20:29 ` Matthias Lederhofer [this message]
2006-08-02 20:50   ` [PATCH] gitweb: require $ENV{'GITWEB_CONFIG'} Jeff King
2006-08-02 20:58     ` Junio C Hamano
2006-08-02 20:59       ` Jeff King
2006-08-02 20:51 ` [PATCH] gitweb: optionally read config from GITWEB_CONFIG Luben Tuikov
2006-08-02 20:56   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1G8NLU-0006TL-J7@moooo.ath.cx \
    --to=matled@gmx.net \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox