Subject: Re: Working on gitweb (was: [PATCHv5] Add Gitweb support for XZ compressed snapshots)

From: Jakub Narebski <[email-masked]>
Date: Mon, 3 Aug 2009 19:26:11 +0200

Dnia sobota 1. sierpnia 2009 13:13, demerphq napisał:

> One thing i notice is that most/all of the existing repos are forks of git.
> 
> And the changes are to gitweb.perl, persumably on the assumption that
> people upgrade using the install process.
> 
> That doesn't make it easy to track changes that are made to the
> production version ("installed" version), unless im missing something.
> 
> How does one set up gitweb so that one can hack its sources and track
> them in a sane way when you are not using make install-gitweb
> (whatever) all the time?

There are at least two possible options. First (that is the one I use)
is to create script to update gitweb, which would run "make gitweb/gitweb.cgi",
with appropriate option, then copy files, like gitweb-update.sh script below.

Second option is to do like t/t9500* gitweb test, which means providing
config file by using GITWEB_CONFIG environment variable, and set all 
required options/variables like $GIT via config file instead of via 
build time configuration.  See also gitweb-run.sh script below.

-- [gitweb-update.sh] --
#!/bin/bash

#BINDIR="/usr/bin"
BINDIR="/home/local/git"

function make_gitweb()
{
	pushd "/home/jnareb/git/"

	make GITWEB_PROJECTROOT="/home/local/scm" \
	     GITWEB_CSS="/gitweb/gitweb.css" \
	     GITWEB_LOGO="/gitweb/git-logo.png" \
	     GITWEB_FAVICON="/gitweb/git-favicon.png" \
	     GITWEB_BLAMEJS="/gitweb/blame.js" \
	     GITWEB_HOMETEXT="/home/local/scm/indextext.html" \
	     bindir=$BINDIR \
	     gitweb/gitweb.cgi

	popd
}

function copy_gitweb()
{
	cp -fv ~/git/gitweb/gitweb.{cgi,css} /home/local/gitweb/
}

make_gitweb
copy_gitweb

# end of gitweb-update.sh

-- [gitweb-run.sh] --
#!/bin/bash

export GATEWAY_INTERFACE="CGI/1.1"
export HTTP_ACCEPT="*/*"
export REQUEST_METHOD="GET"
export QUERY_STRING=""$1""
export PATH_INFO=""$2""

export GITWEB_CONFIG="~/git/gitweb/gitweb_config.perl"

perl -- ~/git/gitweb/gitweb.perl

-- [gitweb_config.perl] --
#!/usr/bin/perl

# gitweb configuration

our $version = "current";
#our $GIT = "/usr/bin/git";
our $GIT = "/home/local/git/git";
our $projectroot = "/home/local/scm";
our $home_link_str = "projects";
our $site_name = "[localhost]";
our $site_header = "";
our $site_footer = "";
our $home_text = "indextext.html";
our @stylesheets = ("file:///home/user/git/gitweb/gitweb.css");
our $logo = "file:///home/user/git/gitweb/git-logo.png";
our $favicon = "file:///home/user/git/gitweb/git-favicon.png";
our $blamejs = "file:///home/user/git/gitweb/blame.js";
our $projects_list = "";
our $export_ok = "";
our $strict_export = "";
our $project_maxdepth = 2007;
our @git_base_url_list = ("/home/user/git");

$feature{'blame'}{'default'} = [1];
$feature{'grep'}{'default'} = [1];
$feature{'pickaxe'}{'default'} = [1];

# end of gitweb_config.perl
-- 
Jakub Narebski
Poland