Skip to content

Instantly share code, notes, and snippets.

@iphoting
Created April 30, 2012 09:13
Show Gist options
  • Save iphoting/2556756 to your computer and use it in GitHub Desktop.
Save iphoting/2556756 to your computer and use it in GitHub Desktop.
Gitolite v3 Tweaks
use lib "/home/gitolite/.gitolite-dist/src/lib";
use Gitolite::Easy;
# HOME of the gitolite user
my $gl_home = $ENV{HOME} = "/home/gitolite";
my $gl_hosting_user = "gitolite";
my $gl_host = $cgi->server_name || "localhost";
# Your server hostname and port (if not 80 for http or 443 for https).
# Replace http for https if necessary.
$my_uri = "https://$gl_host/gitweb";
# the following variables are needed by gitolite; please edit before using
# this should normally not be anything else
$ENV{GL_RC} = "$gl_home/.gitolite.rc";
# this can have different values depending on how you installed.
# if you used RPM/DEB or "root" methods it **might** be this:
#$ENV{GL_BINDIR} = "/usr/local/bin";
# if you used the "non-root" method it **might** be this:
$ENV{GL_BINDIR} = "$gl_home/bin";
# If in doubt take a look at ~/.ssh/authorized_keys; at least one of the lines
# might contain something like:
# command="/home/git/.gitolite/src/gl-auth-command
# and you should use whatever directory the gl-auth-command is in (in this
# example /home/git/.gitolite.src)
# finally the user name
$ENV{GL_USER} = $cgi->remote_user || "daemon";
# set project root etc. absolute paths
$REPO_BASE ||= $ENV{GL_REPO_BASE};
$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$gl_home/$REPO_BASE" );
$projects_list = $projectroot = $ENV{GL_REPO_BASE_ABS};
$export_auth_hook = sub {
my $repo = shift;
# gitweb passes us the full repo path; so we strip the beginning
# and the end, to get the repo name as it is specified in gitolite conf
return unless $repo =~ s/^\Q$projectroot\E\/?(.+)\.git$/$1/;
# check for (at least) "R" permission
return (can_read($repo));
};
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
our @git_base_url_list = ("git://$gl_host", "ssh://$gl_hosting_user\@$gl_host");
# Make gitweb use an alternative format of the URLs which can be
# more readable and natural-looking: project name is embedded
# directly in the path and the query string contains other
# auxiliary information. All gitweb installations recognize
# URL in either format; this configures in which formats gitweb
# generates links.
$feature{'pathinfo'}{'default'} = [1];
# Enable the 'blame' blob view, showing the last commit that modified
# each line in the file. This can be very CPU-intensive.
$feature{'blame'}{'default'} = [1];
# Enable the 'snapshot' link, providing a compressed tarball of any
# tree. This can potentially generate high traffic if you have large
# project.
# To disable system wide have in /etc/gitweb.conf
$feature{'snapshot'}{'default'} = ['tbz2', 'tgz', 'zip'];
# Avatar support. When this feature is enabled, views such as
# shortlog or commit will display an avatar associated with
# the email of the committer(s) and/or author(s).
# Currently available providers are gravatar and picon.
# Gravatar depends on Digest::MD5.
$feature{'avatar'}{'default'} = ['Gravatar'];
# Enable displaying how much time and how many git commands
# it took to generate and display page.
$feature{'timed'}{'default'} = [1];
# Enable turning some links into links to actions which require
# JavaScript to run (like 'blame_incremental').
$feature{'javascript-actions'}{'default'} = [1];
# Used to set the maximum load that we will still respond to gitweb queries.
# If server load exceed this value then return "503 server busy" error.
our $maxload = 2;
# Change below only if you've changed the base path, default: /gitweb
# directory to use for temp files
$git_temp = "/tmp";
# target of the home link on top of all pages
#$home_link = $my_uri || "/";
# html text to include at home page
$home_text = "indextext.html";
# stylesheet to use
$stylesheet = "/gitweb/static/gitweb.css";
# logo to use
$logo = "/gitweb/static/git-logo.png";
# the 'favicon'
$favicon = "/gitweb/static/git-favicon.png";
#!/bin/sh
# placed in src/triggers/post-compile/
# this is literally the simplest gitweb update possible. You are free to add
# whatever you want and contribute it back, as long as it is upward
# compatible.
plf=`gitolite query-rc GITWEB_PROJECTS_LIST`
[ -z "$plf" ] && plf=$HOME/projects.list
(
gitolite list-phy-repos | gitolite access % gitweb R any | grep -v DENIED
gitolite list-phy-repos | gitolite git-config -r % gitweb\\.
) |
cut -f1 | sort -u | while read repo
do
echo "$repo.git" `gitolite git-config $repo gitweb.owner`
done > $plf
#!/bin/bash
# placed in src/triggers/post-compile/
cd `gitolite query-rc GL_REPO_BASE`
cd "$2".git
[ -f gl-creator ] && git config gitweb.owner `cat gl-creator`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment