threads / patch / 27326

patchStarting work on a man page for /etc/gitweb.conf

Subject: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

## tl;dr

11 messages between May 11, 2011 and May 15, 2011. Diffs are folded; open one to read it.

replies: 10people: 4as markdown or json

Drew Northup· May 11, 2011, 19:21 UTC · lore

This is a work in progress. Much of what is in it has been pulled directly from the README and INSTALL files of gitweb. No effort has yet been made to de-duplicate any of this.

TODO:
  * Clean up README and INSTALL files
  * Add Makefile rules to build man / HTML pages.
  * Remove or rephrase redundant portions of original documentation
  * A lot more...
---

Notes: There ARE INTENTIONAL WHITESPACE ERRORS (Yuck!) to make asciidoc happy. :-(

I have been compiling this with a hand-made test-script into both manpage and HTML formats during my testing. It was made by observing what make was doing on my platform @home (Slackware 13.0 currently).

This is not quite ready for the big time, so I expect (and hope for) lots of criticism (of the constructive kind?).

If you don't really need (or want) to be on the CC list let me know. You were in the output of 'git blame'....

 gitweb/gitweb.conf.txt |  294 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 294 insertions(+), 0 deletions(-)
 create mode 100644 gitweb/gitweb.conf.txt
Show changes to gitweb/gitweb.conf.txt +294 −0
diff --git a/gitweb/gitweb.conf.txt b/gitweb/gitweb.conf.txt
new file mode 100644
index 0000000..c14847a
--- /dev/null
+++ b/gitweb/gitweb.conf.txt
@@ -0,0 +1,294 @@
+gitweb.conf(5)
+==============
+
+NAME
+----
+gitweb.conf - Gitweb configuration file
+
+SYNOPSIS
+--------
+/etc/gitweb.conf
+
+DESCRIPTION
+-----------
+'Gitweb' is a CGI application for viewing Git repositories over the web. The
+configuration file is used to override the default settings that were built
+into gitweb at the time Git itself was compiled. While one could just alter
+the configuration settings in the gitweb CGI itself, those changes would be
+lost upon upgrade. Configuration settings my also be placed into a file in
+the same directory as the CGI script with the default name
+`gitweb_config.perl` – allowing one to have multiple gitweb instances
+with different configurations by the use of symlinks.
+
+
+DISCUSSION
+----------
+
+The location of `gitweb.conf` is defined at compile time using the
+configuration value `GITWEB_CONFIG_SYSTEM` and defaults to /etc/gitweb.conf.
+The name of the per-instance configuration file is defined in gitweb by
+`GITWEB_CONFIG`.
+
+*NOTE:* Values defined in the per-instance configuration file override both
+values found in the gitweb CGI as well as values found in the sytem-wide
+gitweb.conf file.
+
+The syntax of the configuration files is that of PERL, as these files are
+indeed handled as fragments of PERL code (the language that gitweb itself is
+written in). Variables may be set using "'our $variable = value'"; text from
+"#" character until the end of a line is ignored. See the perlsyn(1) man page
+for more information.
+
+One good reason to take advatage of the system-wide and local gitweb
+configuration files is that not all settings may be set up directly in the CGI
+itself. Optional features – defined using the '%features' variable
+– must be set in one of the two configuration files.
+
+CONFIGURATION SETTINGS
+----------------------
+Standard Options
+~~~~~~~~~~~~~~~~~
+The following are not typically set or overridden at build time:
+
+$GIT::
+	Core git executable to use.  By default set to `$GIT_BINDIR/git`, which
+	in turn is by default set to `$(bindir)/git`.  If you use git from binary
+	package, set this to "/usr/bin/git".  This can just be "git" if your
+	webserver has a sensible PATH.  If you have multiple git versions installed
+	it can be used to choose which one to use.
+$version::
+	Gitweb version, set automatically when creating gitweb.cgi from
+	gitweb.perl. You might want to modify it if you are running modified
+	gitweb.
+$projectroot::
+	Absolute filesystem path which will be prepended to project path;
+	the path to repository is `$projectroot/$project`.  Set to
+	`$GITWEB_PROJECTROOT` during installation.  This variable has to be
+	set correctly for gitweb to find repositories.
+$projects_list::
+	Source of projects list, either directory to scan, or text file
+	with list of repositories (in the "`<URI-encoded repository path> SP
+	<URI-encoded repository owner>`" line format; actually there can be
+	any sequence of whitespace in place of space (SP)).  Set to
+	`$GITWEB_LIST` during installation.  If empty, `$projectroot` is used
+	to scan for repositories.
+$my_url, $my_uri::
+	Full URL and absolute URL of gitweb script;
+	in earlier versions of gitweb you might have need to set those
+	variables, now there should be no need to do it.  See
+	`$per_request_config` if you need to set them still.
+$base_url::
+	Base URL for relative URLs in pages generated by gitweb,
+	(e.g. `$logo`, `$favicon`, `@stylesheets` if they are relative URLs),
+	needed and used only for URLs with nonempty PATH_INFO via
+	'<base href="$base_url">'.  Usually gitweb sets its value correctly,
+	and there is no need to set this variable, e.g. to $my_uri or "/".
+	See `$per_request_config` if you need to set it anyway.
+$home_link::
+	Target of the home link on top of all pages (the first part of view
+	"breadcrumbs").  By default set to absolute URI of a page ($my_uri).
+@stylesheets::
+	List of URIs of stylesheets (relative to base URI of a page). You
+	might specify more than one stylesheet, for example use gitweb.css
+	as base, with site specific modifications in separate stylesheet
+	to make it easier to upgrade gitweb. You can add a `site` stylesheet
+	for example by using +
+		`push @stylesheets, "gitweb-site.css";`  + 
+	in the gitweb config file.
+$logo_url, $logo_label::
+	URI and label (title) of GIT logo link (or your site logo, if you choose
+	to use different logo image). By default they point to git homepage;
+	in the past they pointed to git documentation at www.kernel.org.
+$projects_list_description_width::
+	The width (in characters) of the projects list "Description" column.
+	Longer descriptions will be cut (trying to cut at word boundary);
+	full description is available as 'title' attribute (usually shown on
+	mouseover).  By default set to 25, which might be too small if you
+	use long project descriptions.
+@git_base_url_list::
+	List of git base URLs used for URL to where fetch project from, shown
+	in project summary page.  Full URL is "`$git_base_url/$project`".
+	You can setup multiple base URLs (for example one for  git:// protocol
+	access, and one for http:// "dumb" protocol access).  Note that per
+	repository configuration in 'cloneurl' file, or as values of gitweb.url
+	project config.
+$default_blob_plain_mimetype::
+	Default mimetype for blob_plain (raw) view, if mimetype checking
+	doesn't result in some other type; by default 'text/plain'.
+$default_text_plain_charset::
+	Default charset for text files. If not set, web server configuration
+	would be used.
+$mimetypes_file::
+	File to use for (filename extension based) guessing of MIME types before
+	trying /etc/mime.types. Path, if relative, is taken currently as
+	relative to the current git repository.
+$fallback_encoding::
+	Gitweb assumes this charset if line contains non-UTF-8 characters.
+	Fallback decoding is used without error checking, so it can be even
+	'utf-8'. Value must be valid encoding; see Encoding::Supported(3pm) man
+	page for a list.   By default 'latin1', aka. 'iso-8859-1'.
+@diff_opts::
+	Rename detection options for git-diff and git-diff-tree. By default
+	(\'-M'); set it to (\'-C') or (\'-C', \'-C') to also detect copies, or
+	set it to () if you don't want to have renames detection.
+$prevent_xss::
+	If true, some gitweb features are disabled to prevent content in
+	repositories from launching cross-site scripting (XSS) attacks.  Set this
+	to true if you don't trust the content of your repositories.
+[Default: false].
+$maxload::
+	Used to set the maximum load that we will still respond to gitweb queries.
+	If server load exceed this value then return "503 Service Unavailable"
+	error. Server load is taken to be 0 if gitweb cannot determine its value.
+	Set it to undefined value to turn it off. [Default: 300]
+$highlight_bin::
+	Path to the highlight executable to use (must be the one from
+	http://www.andre-simon.de due to assumptions about parameters and output).
+	Useful if highlight is not installed on your webserver's PATH.
+	[Default: highlight]
+$per_request_config::
+	If set to code reference, it would be run once per each request.  You can
+	set parts of configuration that change per session, e.g. by setting it to +
+		`sub { $ENV{GL_USER} = $cgi->remote_user || "gitweb"; }`  + 
+	Otherwise it is treated as boolean value: if true gitweb would process
+	config file once per request, if false it would process config file only
+	once.  Note: $my_url, $my_uri, and $base_url are overwritten with
+	their default values before every request, so if you want to change
+	them, be sure to set this variable to true or a code reference effecting
+	the desired changes.  [Default: true]
+
+Configuration Options Often Set at Compile Time
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+These configuration variables are often specified at compile time and are
+defined by default in the gitweb CGI itself:
+
+GIT_BINDIR::
+	Points where to find the git executable.  You should set it up to
+	the place where the git binary was installed (usually /usr/bin) if you
+	don't install git from sources together with gitweb.  [Default: $(bindir)]
+GITWEB_SITENAME::
+	Shown in the title of all generated pages, defaults to the server name
+	(SERVER_NAME CGI environment variable) if not set. [No default]
+GITWEB_PROJECTROOT::
+	The root directory for all projects shown by gitweb. Must be set
+	correctly for gitweb to find repositories to display.  See also
+	"Gitweb repositories" in the INSTALL file for gitweb.  [Default: /pub/git]
+GITWEB_PROJECT_MAXDEPTH::
+	The filesystem traversing limit for getting the project list; the number
+	is taken as depth relative to the projectroot.  It is used when
+	GITWEB_LIST is a directory (or is not set; then project root is used).
+	Is is meant to speed up project listing on large work trees by limiting
+	search depth.  [Default: 2007]
+GITWEB_LIST::
+	Points to a directory to scan for projects (defaults to project root
+	if not set / if empty) or to a file with explicit listing of projects
+	(together with projects' ownership). See "Generating projects list
+	using gitweb" in INSTALL file for gitweb to find out how to generate
+	such file from scan of a directory. [No default, which means use root
+	directory for projects]
+GITWEB_EXPORT_OK::
+	Show repository only if this file exists (in repository).  Only
+	effective if this variable evaluates to true.  [No default / Not set]
+GITWEB_STRICT_EXPORT::
+	Only allow viewing of repositories also shown on the overview page.
+	This for example makes GITWEB_EXPORT_OK to decide if repository is
+	available and not only if it is shown.  If GITWEB_LIST points to
+	file with list of project, only those repositories listed would be
+	available for gitweb.  [No default]
+GITWEB_HOMETEXT::
+	Points to an .html file which is included on the gitweb project
+	overview page ('projects_list' view), if it exists.  Relative to
+	gitweb.cgi script.  [Default: indextext.html]
+GITWEB_SITE_HEADER::
+	Filename of html text to include at top of each page.  Relative to
+	gitweb.cgi script.  [No default]
+GITWEB_SITE_FOOTER::
+	Filename of html text to include at bottom of each page.  Relative to
+	gitweb.cgi script.  [No default]
+GITWEB_HOME_LINK_STR::
+	String of the home link on top of all pages, leading to $home_link
+	(usually main gitweb page, which means projects list).  Used as first
+	part of gitweb view "breadcrumb trail": <home> / <project> / <view>.
+	[Default: projects]
+GITWEB_SITENAME::
+	Name of your site or organization to appear in page titles.  Set it
+	to something descriptive for clearer bookmarks etc.  If not set
+	(if empty) gitweb uses "$SERVER_NAME Git", or "Untitled Git" if
+	SERVER_NAME CGI environment variable is not set (e.g. if running
+	gitweb as standalone script).  [No default]
+GITWEB_BASE_URL::
+	Git base URLs used for URL to where fetch project from, i.e. full
+	URL is "$git_base_url/$project".  Shown on projects summary page.
+	Repository URL for project can be also configured per repository; this
+	takes precedence over URLs composed from base URL and a project name.
+	Note that you can setup multiple base URLs (for example one for
+	git:// protocol access, another for http:// access) from the gitweb
+	config file.  [No default]
+GITWEB_CSS::
+	Points to the location where you put gitweb.css on your web server
+	(or to be more generic, the URI of gitweb stylesheet).  Relative to the
+	base URI of gitweb.  Note that you can setup multiple stylesheets from
+	the gitweb config file.  [Default: static/gitweb.css (or
+	static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier
+	is used)]
+GITWEB_LOGO::
+	Points to the location where you put git-logo.png on your web server
+	(or to be more generic URI of logo, 72x27 size, displayed in top right
+	corner of each gitweb page, and used as logo for Atom feed).  Relative
+	to base URI of gitweb.  [Default: static/git-logo.png]
+GITWEB_FAVICON::
+	Points to the location where you put git-favicon.png on your web server
+	(or to be more generic URI of favicon, assumed to be image/png type;
+	web browsers that support favicons (website icons) may display them
+	in the browser's URL bar and next to site name in bookmarks).  Relative
+	to base URI of gitweb.  [Default: static/git-favicon.png]
+GITWEB_JS::
+	Points to the location where you put gitweb.js on your web server
+	(or to be more generic URI of JavaScript code used by gitweb).
+	Relative to base URI of gitweb.  [Default: static/gitweb.js (or
+	static/gitweb.min.js if JSMIN build variable is defined / JavaScript
+	minifier is used)]
+HIGHLIGHT_BIN::
+	Path to the highlight executable to use (must be the one from
+	http://www.andre-simon.de due to assumptions about parameters and output).
+	Useful if highlight is not installed on your webserver's PATH.
+	[Default: highlight]
+
+
+Configuration File Example
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To enable blame, pickaxe search, and snapshot support, while allowing
+individual projects to turn them off, put the following in your
+GITWEB_CONFIG file:
+
+        $feature{'blame'}{'default'} = [1];
+        $feature{'blame'}{'override'} = 1;
+
+        $feature{'pickaxe'}{'default'} = [1];
+        $feature{'pickaxe'}{'override'} = 1;
+
+        $feature{'snapshot'}{'default'} = ['zip', 'tgz'];
+        $feature{'snapshot'}{'override'} = 1;
+
+If you allow overriding for the snapshot feature, you can specify which
+snapshot formats are globally disabled. You can also add any command line
+options you want (such as setting the compression level). For instance,
+you can disable Zip compressed snapshots and set GZip to run at level 6 by
+adding the following lines to your $GITWEB_CONFIG:
+
+        $known_snapshot_formats{'zip'}{'disabled'} = 1;
+        $known_snapshot_formats{'tgz'}{'compressor'} = ['gzip','-6'];
+
+FILES
+-----
+/etc/gitweb.conf, gitweb_config.perl
+
+
+SEE ALSO
+--------
+In Progress
+
+GIT
+---
+Part of the linkgit:git[1] suite
-- 
1.7.4.1
Jonathan Nieder· May 12, 2011, 10:53 UTC · re: Drew Northup · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

Hi Drew,
Drew Northup wrote:
> This is a work in progress. Much of what is in it has been pulled
> directly from the README and INSTALL files of gitweb. No effort has yet
> been made to de-duplicate any of this.
Thanks!
Show 5 quoted lines
> TODO:
>   * Clean up README and INSTALL files
>   * Add Makefile rules to build man / HTML pages.
>   * Remove or rephrase redundant portions of original documentation
>   * A lot more...

I agree with this TODO list. :) It should be possible to reuse rules from Documentation/Makefile if you put this under Documentation/. gitweb already keeps its tests under t/ for convenience; I think it's okay if it puts some documentation under Documentation/.

> If you don't really need (or want) to be on the CC list let me know. You were
> in the output of 'git blame'....

I've aggressively culled the cc list for my reply to avoid punishing kind people who improved gitweb by swamping them with mail.

Show 9 quoted lines
> --- /dev/null
> +++ b/gitweb/gitweb.conf.txt
> @@ -0,0 +1,294 @@
> +gitweb.conf(5)
> +==============
> +
> +NAME
> +----
> +gitweb.conf - Gitweb configuration file

It sounds like a tautology. Maybe "configuration for git's web interface"? Except that there is at least one other web interface for git (cgit). Hm.

> +
> +SYNOPSIS
> +--------
> +/etc/gitweb.conf

gitweb will also look for gitweb_config.perl along @INC, and the $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM envvars can override these paths.

Show 6 quoted lines
> +
> +DESCRIPTION
> +-----------
> +'Gitweb' is a CGI application for viewing Git repositories over the web. The
> +configuration file is used to override the default settings that were built
> +into gitweb at the time Git itself was compiled.

Style nit: I'd launch into what gitweb.conf contains right away, like so:

	The gitweb CGI script for viewing Git repositories over the
	web uses a perl script fragment as its configuration file.
	You can set variables using "our $variable = value"; text
	from a "#" character until the end of a line is ignored.
	See *perlsyn*(1) for details.
	The configuration file is used to override the default
	settings that were built into gitweb at the time it was
	installed.
Show 6 quoted lines
> While one could just alter
> +the configuration settings in the gitweb CGI itself, those changes would be
> +lost upon upgrade. Configuration settings my also be placed into a file in
> +the same directory as the CGI script with the default name
> +`gitweb_config.perl` &#8211; allowing one to have multiple gitweb instances
> +with different configurations by the use of symlinks.
Good point; I hadn't thought about the multiple-configurations use case.
Show 11 quoted lines
> +DISCUSSION
> +----------
> +
> +The location of `gitweb.conf` is defined at compile time using the
> +configuration value `GITWEB_CONFIG_SYSTEM` and defaults to /etc/gitweb.conf.
> +The name of the per-instance configuration file is defined in gitweb by
> +`GITWEB_CONFIG`.
> +
> +*NOTE:* Values defined in the per-instance configuration file override both
> +values found in the gitweb CGI as well as values found in the sytem-wide
> +gitweb.conf file.
Doesn't gitweb_config.perl suppress the effect of gitweb.conf altogether?
Show 6 quoted lines
> +
> +The syntax of the configuration files is that of PERL, as these files are
> +indeed handled as fragments of PERL code (the language that gitweb itself is
> +written in). Variables may be set using "'our $variable = value'"; text from
> +"#" character until the end of a line is ignored. See the perlsyn(1) man page
> +for more information.

The perl manual spells the name of that language as "Perl". I think it might make sense to mention the syntax earlier, since it makes it less daunting to dive into the file right away.

Show 5 quoted lines
> +
> +One good reason to take advatage of the system-wide and local gitweb
> +configuration files is that not all settings may be set up directly in the CGI
> +itself. Optional features &#8211; defined using the '%features' variable
> +&#8211; must be set in one of the two configuration files.

I don't follow what this paragraph is saying. Is the idea something like this?

	The default configuration with no configuration file at all
	may work perfectly well for some installations.  Still, a
	configuration file is useful for customizing or tweaking the
	behavior of gitweb in many ways, and some optional features
	will not be present unless explicitly enabled using the
	configurable %features variable.
> +
> +CONFIGURATION SETTINGS
> +----------------------
Configuration settings as opposed to non-configuration settings? :)
Maybe something like
	VARIABLES
	---------
would be clearer.
> +Standard Options
> +~~~~~~~~~~~~~~~~~
> +The following are not typically set or overridden at build time:
I suppose the above is a paraphrase of
 (with the exception of $projectroot and $projects_list this list does
 not include variables usually directly set during build):

but this shortened version just left me confused (why do I care which variables people typically override at build time?). The original suggests that for build-time configuration I should look elsewhere, which made it a little clearer to me.

> +
> +$GIT::
> +	Core git executable to use.

Ah, what a variable to start with. Maybe this can be snuck later in the list somehow, so the reader can get to juicier bits first.

> +$version::
> +	Gitweb version, set automatically when creating gitweb.cgi from
> +	gitweb.perl. You might want to modify it if you are running modified
> +	gitweb.

Why would I want to set this in the config file? Wouldn't my patch to gitweb.cgi modify $version?

Show 5 quoted lines
> +$projectroot::
> +	Absolute filesystem path which will be prepended to project path;
> +	the path to repository is `$projectroot/$project`.  Set to
> +	`$GITWEB_PROJECTROOT` during installation.  This variable has to be
> +	set correctly for gitweb to find repositories.

This is an interesting one. The description is not so clear to me --- I guess the idea is that if $projectroot = "/srv/git" then

 http://path/to/gitweb/installation/?p=foo/bar.git

will map to /srv/git/foo/bar.git on the filesystem (and likewise for PATH_INFO based URLs)?

Show 7 quoted lines
> +$projects_list::
> +	Source of projects list, either directory to scan, or text file
> +	with list of repositories (in the "`<URI-encoded repository path> SP
> +	<URI-encoded repository owner>`" line format; actually there can be
> +	any sequence of whitespace in place of space (SP)).  Set to
> +	`$GITWEB_LIST` during installation.  If empty, `$projectroot` is used
> +	to scan for repositories.

Maybe clearer to emphasize the kinds of values it takes first? That is:

	Space-separated list of paths to files listing projects or
	directories to be scanned for projects.  Project list files
	should list one project per line, with each line having the
	format "`<URI-encoded filesystem path to repository> SP
	<URI-encoded repository owner>`.  The default is determined
	by the GITWEB_LIST makefile variable at installation time.
	If this variable is empty, gitweb will fall back to scanning
	the `$projectroot` for repositories.
[...]
Show 9 quoted lines
> +Configuration Options Often Set at Compile Time
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +These configuration variables are often specified at compile time and are
> +defined by default in the gitweb CGI itself:
> +
> +GIT_BINDIR::
> +	Points where to find the git executable.  You should set it up to
> +	the place where the git binary was installed (usually /usr/bin) if you
> +	don't install git from sources together with gitweb.  [Default: $(bindir)]

I don't think there is a GIT_BINDIR configuration variable, though there is a makefile variable with that name used to determine the default value of $GIT.

Likewise for the others.  I don't think they belong in the manpage.
[...]
> +Configuration File Example
> +~~~~~~~~~~~~~~~~~~~~~~~~~~

Ah, glad you did this. I would make "Example" or "Examples" a separate top-level section so they are easier to find.

Ok, that's all for now.  Still, hope that helps.

Regards, Jonathan

Jakub Narebski· May 12, 2011, 15:01 UTC · re: Jonathan Nieder · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On Thu, 12 May 2011, Jonathan Nieder wrote:
Show 5 quoted lines
> Drew Northup wrote:
> 
> > This is a work in progress. Much of what is in it has been pulled
> > directly from the README and INSTALL files of gitweb. No effort has yet
> > been made to de-duplicate any of this.

While it might be a good idea to split main part of gitweb/README into gitweb.conf.txt (documenting configuration), and perhaps also separate gitweb.txt (main page for gitweb, like SVN::Web manpage), I don't think that much of gitweb/INSTALL should be moved.

Show 10 quoted lines
> > TODO:
> >   * Clean up README and INSTALL files
> >   * Add Makefile rules to build man / HTML pages.
> >   * Remove or rephrase redundant portions of original documentation
> >   * A lot more...
> 
> I agree with this TODO list. :)  It should be possible to reuse rules from
> Documentation/Makefile if you put this under Documentation/.  gitweb already
> keeps its tests under t/ for convenience; I think it's okay if it
> puts some documentation under Documentation/.

Note that git-gui and gitk both also keep their manpages in Documentation/ as Documentation/git-gui.txt and Documentation/gitk.txt

We can add "doc" target to gitweb/Makefile, which would delegate work to ../Documentation/Makefile, similarly to existing "test" target in gitweb/Makefile.

Show 13 quoted lines
> > --- /dev/null
> > +++ b/gitweb/gitweb.conf.txt
> > @@ -0,0 +1,294 @@
> > +gitweb.conf(5)
> > +==============
> > +
> > +NAME
> > +----
> > +gitweb.conf - Gitweb configuration file
> 
> It sounds like a tautology.  Maybe "configuration for git's web
> interface"?  Except that there is at least one other web interface for
> git (cgit).  Hm.

Let's take a look how it is done in other section 5 manpages documenting configuration files:

  dhclient.conf(5):  dhclient.conf - DHCP client configuration file
  ldap.conf(5):      ldap.conf, .ldaprc - ldap configuration file
  yum.con(5):        yum.conf - Configuration file for yum(8).
So it is not much of tautology, I think.
 
> > +
> > +SYNOPSIS
> > +--------
> > +/etc/gitweb.conf
I'd say
    +SYNOPSIS
    +--------
    +gitweb_conf.perl
    +/etc/gitweb.conf
or
    +SYNOPSIS
    +--------
    +$GITWEBDIR/gitweb_conf.perl
    +/etc/gitweb.conf
 
> gitweb will also look for gitweb_config.perl along @INC, and
> the $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM envvars can override
> these paths.
I think that we don't need to describe envvars in synopsis, but we
should have per-gitweb configuration file (gitweb_conf.perl) in
"Synopsis" section.
 
Show 19 quoted lines
> > +
> > +DESCRIPTION
> > +-----------
> > +'Gitweb' is a CGI application for viewing Git repositories over the web. The
> > +configuration file is used to override the default settings that were built
> > +into gitweb at the time Git itself was compiled.
> 
> Style nit: I'd launch into what gitweb.conf contains right away, like
> so:
> 
> 	The gitweb CGI script for viewing Git repositories over the
> 	web uses a perl script fragment as its configuration file.
> 	You can set variables using "our $variable = value"; text
> 	from a "#" character until the end of a line is ignored.
> 	See *perlsyn*(1) for details.
> 
> 	The configuration file is used to override the default
> 	settings that were built into gitweb at the time it was
> 	installed.
I agree with Jonathan here.
 
Show 8 quoted lines
> > +While one could just alter
> > +the configuration settings in the gitweb CGI itself, those changes would be
> > +lost upon upgrade. Configuration settings my also be placed into a file in
> > +the same directory as the CGI script with the default name
> > +`gitweb_config.perl` &#8211; allowing one to have multiple gitweb instances
> > +with different configurations by the use of symlinks.
> 
> Good point; I hadn't thought about the multiple-configurations use case.
Right.
Show 13 quoted lines
> > +DISCUSSION
> > +----------
> > +
> > +The location of `gitweb.conf` is defined at compile time using the
> > +configuration value `GITWEB_CONFIG_SYSTEM` and defaults to /etc/gitweb.conf.
> > +The name of the per-instance configuration file is defined in gitweb by
> > +`GITWEB_CONFIG`.
> > +
> > +*NOTE:* Values defined in the per-instance configuration file override both
> > +values found in the gitweb CGI as well as values found in the sytem-wide
> > +gitweb.conf file.
> 
> Doesn't gitweb_config.perl suppress the effect of gitweb.conf altogether?
Yes it does.
The sequence is as following:
1. Per-gitweb configuration file is given by envvar GITWEB_CONFIG; if it
   is not set, then by default gitweb_conf.perl is used (one can override
   the latter name via build-time configuration variable GITWEB_CONFIG).
   Note: relative path means relative to installed gitweb.cgi script.
2. System-wide configuration file is given by envvar GITWEB_CONFIG_SYSTEM;
   if it is not set, then by default /etc/gitweb.conf is used (one can
   override the latter name via build-time configuration variable
   GITWEB_CONFIG_SYSTEM).  Note: sysconfdir is not taken into account
   by gitweb/Makefile, but perhaps it should.
 
Gitweb obtains configuration data from the following sources in the
following order:
  1. gitweb's installation configuration file ($GITWEBDIR/gitweb_conf.perl)
  2. system-wide configuration file (/etc/gitweb.conf)
First existing config file is used.
Sidenote: we could replace GITWE_CONFIG and GITWEB_CONFIG_SYSTEM in 
gitweb.conf.txt during building documentation.
Show 6 quoted lines
> > +
> > +The syntax of the configuration files is that of PERL, as these files are
> > +indeed handled as fragments of PERL code (the language that gitweb itself is
> > +written in). Variables may be set using "'our $variable = value'"; text from
> > +"#" character until the end of a line is ignored. See the perlsyn(1) man page
> > +for more information.
Actually using 'our $variable = <value>' is a safety check: if newer gitweb
does no longer use given value, using 'our' wouldn't cause errors.
 
> The perl manual spells the name of that language as "Perl".  I think
> it might make sense to mention the syntax earlier, since it makes it
> less daunting to dive into the file right away.
I think it might be good idea to provide bare-bones example here.
 
Show 15 quoted lines
> > +
> > +One good reason to take advatage of the system-wide and local gitweb
> > +configuration files is that not all settings may be set up directly in the CGI
> > +itself. Optional features &#8211; defined using the '%features' variable
> > +&#8211; must be set in one of the two configuration files.
> 
> I don't follow what this paragraph is saying.  Is the idea something
> like this?
> 
> 	The default configuration with no configuration file at all
> 	may work perfectly well for some installations.  Still, a
> 	configuration file is useful for customizing or tweaking the
> 	behavior of gitweb in many ways, and some optional features
> 	will not be present unless explicitly enabled using the
> 	configurable %features variable.

I think the idea is that not all of configuration knobs can be tweaked during "compile"-time. Some require setting from configuration file.

Note: we probably want to mention gitweb/config.mak or config.mak somewhere
as place to save build-time configuration, persistently.
Show 12 quoted lines
> > +
> > +CONFIGURATION SETTINGS
> > +----------------------
> 
> Configuration settings as opposed to non-configuration settings? :)
> 
> Maybe something like
> 
> 	VARIABLES
> 	---------
> 
> would be clearer.
Perhaps.
 
> > +Standard Options
> > +~~~~~~~~~~~~~~~~~
> > +The following are not typically set or overridden at build time:
[...]
Show 6 quoted lines
> > +
> > +$GIT::
> > +	Core git executable to use.
> 
> Ah, what a variable to start with.  Maybe this can be snuck later in
> the list somehow, so the reader can get to juicier bits first.
This is set at build time, by default to $(bindir)/git
Show 7 quoted lines
> > +$version::
> > +	Gitweb version, set automatically when creating gitweb.cgi from
> > +	gitweb.perl. You might want to modify it if you are running modified
> > +	gitweb.
> 
> Why would I want to set this in the config file?  Wouldn't my patch to
> gitweb.cgi modify $version?
Well, for running gitweb.perl (not build!) from command line I use
  our $version = "current";
But this is I think rare case.
 
Show 13 quoted lines
> > +$projectroot::
> > +	Absolute filesystem path which will be prepended to project path;
> > +	the path to repository is `$projectroot/$project`.  Set to
> > +	`$GITWEB_PROJECTROOT` during installation.  This variable has to be
> > +	set correctly for gitweb to find repositories.
> 
> This is an interesting one.  The description is not so clear to me ---
> I guess the idea is that if $projectroot = "/srv/git" then
> 
>  http://path/to/gitweb/installation/?p=foo/bar.git
> 
> will map to /srv/git/foo/bar.git on the filesystem (and likewise for
> PATH_INFO based URLs)?
Yes.
Show 19 quoted lines
> > +$projects_list::
> > +	Source of projects list, either directory to scan, or text file
> > +	with list of repositories (in the "`<URI-encoded repository path> SP
> > +	<URI-encoded repository owner>`" line format; actually there can be
> > +	any sequence of whitespace in place of space (SP)).  Set to
> > +	`$GITWEB_LIST` during installation.  If empty, `$projectroot` is used
> > +	to scan for repositories.
> 
> Maybe clearer to emphasize the kinds of values it takes first?  That
> is:
> 
> 	Space-separated list of paths to files listing projects or
> 	directories to be scanned for projects.  Project list files
> 	should list one project per line, with each line having the
> 	format "`<URI-encoded filesystem path to repository> SP
> 	<URI-encoded repository owner>`.  The default is determined
> 	by the GITWEB_LIST makefile variable at installation time.
> 	If this variable is empty, gitweb will fall back to scanning
> 	the `$projectroot` for repositories.
I think to not have long wall of text here, we should reference part
of documentation that explains how gitweb finds repositories, including
format of $projects_list file.
 
Show 16 quoted lines
> [...]
> > +Configuration Options Often Set at Compile Time
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +These configuration variables are often specified at compile time and are
> > +defined by default in the gitweb CGI itself:
> > +
> > +GIT_BINDIR::
> > +	Points where to find the git executable.  You should set it up to
> > +	the place where the git binary was installed (usually /usr/bin) if you
> > +	don't install git from sources together with gitweb.  [Default: $(bindir)]
> 
> I don't think there is a GIT_BINDIR configuration variable, though
> there is a makefile variable with that name used to determine the
> default value of $GIT.
> 
> Likewise for the others.  I don't think they belong in the manpage.

I agree. What is important during build time "only" should remain in gitweb/INSTALL.

-- 
Jakub Narebski
Poland
Drew Northup· May 12, 2011, 17:03 UTC · re: Jakub Narebski · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On Thu, 2011-05-12 at 17:01 +0200, Jakub Narebski wrote:
Show 11 quoted lines
> On Thu, 12 May 2011, Jonathan Nieder wrote:
> > Drew Northup wrote:
> > 
> > > This is a work in progress. Much of what is in it has been pulled
> > > directly from the README and INSTALL files of gitweb. No effort has yet
> > > been made to de-duplicate any of this.
> 
> While it might be a good idea to split main part of gitweb/README into
> gitweb.conf.txt (documenting configuration), and perhaps also separate
> gitweb.txt (main page for gitweb, like SVN::Web manpage), I don't think
> that much of gitweb/INSTALL should be moved.

That's pretty much my conclusion as well. I'm focusing solely on the configuration portion right now. A main page for Gitweb itself will definitely be useful.

Show 13 quoted lines
> > > TODO:
> > >   * Clean up README and INSTALL files
> > >   * Add Makefile rules to build man / HTML pages.
> > >   * Remove or rephrase redundant portions of original documentation
> > >   * A lot more...
> > 
> > I agree with this TODO list. :)  It should be possible to reuse rules from
> > Documentation/Makefile if you put this under Documentation/.  gitweb already
> > keeps its tests under t/ for convenience; I think it's okay if it
> > puts some documentation under Documentation/.
> 
> Note that git-gui and gitk both also keep their manpages in Documentation/
> as Documentation/git-gui.txt and Documentation/gitk.txt

I've been keeping my work in the gitweb directory mostly for convenience. I've put my "compilation" script there for testing the asciidoc compilation just so that I don't need to mess with make for the time being.

> We can add "doc" target to gitweb/Makefile, which would delegate work to
> ../Documentation/Makefile, similarly to existing "test" target in
> gitweb/Makefile.

That makes sense to me. Shouldn't be too much work for me to piece that together when I'm ready.

Show 22 quoted lines
> > > --- /dev/null
> > > +++ b/gitweb/gitweb.conf.txt
> > > @@ -0,0 +1,294 @@
> > > +gitweb.conf(5)
> > > +==============
> > > +
> > > +NAME
> > > +----
> > > +gitweb.conf - Gitweb configuration file
> > 
> > It sounds like a tautology.  Maybe "configuration for git's web
> > interface"?  Except that there is at least one other web interface for
> > git (cgit).  Hm.
> 
> Let's take a look how it is done in other section 5 manpages documenting
> configuration files:
> 
>   dhclient.conf(5):  dhclient.conf - DHCP client configuration file
>   ldap.conf(5):      ldap.conf, .ldaprc - ldap configuration file
>   yum.con(5):        yum.conf - Configuration file for yum(8).
> 
> So it is not much of tautology, I think.

I had started with resolv.conf(5) actually. Same idea--concise but perhaps not amazingly informative.

Show 26 quoted lines
> > > +
> > > +SYNOPSIS
> > > +--------
> > > +/etc/gitweb.conf
> 
> I'd say
> 
>     +SYNOPSIS
>     +--------
>     +gitweb_conf.perl
>     +/etc/gitweb.conf
> 
> or
> 
>     +SYNOPSIS
>     +--------
>     +$GITWEBDIR/gitweb_conf.perl
>     +/etc/gitweb.conf
>  
> > gitweb will also look for gitweb_config.perl along @INC, and
> > the $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM envvars can override
> > these paths.
> 
> I think that we don't need to describe envvars in synopsis, but we
> should have per-gitweb configuration file (gitweb_conf.perl) in
> "Synopsis" section.
Sounds reasonable to me.
 
Show 21 quoted lines
> > > +
> > > +DESCRIPTION
> > > +-----------
> > > +'Gitweb' is a CGI application for viewing Git repositories over the web. The
> > > +configuration file is used to override the default settings that were built
> > > +into gitweb at the time Git itself was compiled.
> > 
> > Style nit: I'd launch into what gitweb.conf contains right away, like
> > so:
> > 
> > 	The gitweb CGI script for viewing Git repositories over the
> > 	web uses a perl script fragment as its configuration file.
> > 	You can set variables using "our $variable = value"; text
> > 	from a "#" character until the end of a line is ignored.
> > 	See *perlsyn*(1) for details.
> > 
> > 	The configuration file is used to override the default
> > 	settings that were built into gitweb at the time it was
> > 	installed.
> 
> I agree with Jonathan here.
Comment noted. Perhaps resolv.conf(5) wasn't the best example for
this...
 
Show 47 quoted lines
> > > +While one could just alter
> > > +the configuration settings in the gitweb CGI itself, those changes would be
> > > +lost upon upgrade. Configuration settings my also be placed into a file in
> > > +the same directory as the CGI script with the default name
> > > +`gitweb_config.perl` &#8211; allowing one to have multiple gitweb instances
> > > +with different configurations by the use of symlinks.
> > 
> > Good point; I hadn't thought about the multiple-configurations use case.
> 
> Right.
> 
> > > +DISCUSSION
> > > +----------
> > > +
> > > +The location of `gitweb.conf` is defined at compile time using the
> > > +configuration value `GITWEB_CONFIG_SYSTEM` and defaults to /etc/gitweb.conf.
> > > +The name of the per-instance configuration file is defined in gitweb by
> > > +`GITWEB_CONFIG`.
> > > +
> > > +*NOTE:* Values defined in the per-instance configuration file override both
> > > +values found in the gitweb CGI as well as values found in the sytem-wide
> > > +gitweb.conf file.
> > 
> > Doesn't gitweb_config.perl suppress the effect of gitweb.conf altogether?
> 
> Yes it does.
> 
> The sequence is as following:
> 
> 1. Per-gitweb configuration file is given by envvar GITWEB_CONFIG; if it
>    is not set, then by default gitweb_conf.perl is used (one can override
>    the latter name via build-time configuration variable GITWEB_CONFIG).
>    Note: relative path means relative to installed gitweb.cgi script.
> 
> 2. System-wide configuration file is given by envvar GITWEB_CONFIG_SYSTEM;
>    if it is not set, then by default /etc/gitweb.conf is used (one can
>    override the latter name via build-time configuration variable
>    GITWEB_CONFIG_SYSTEM).  Note: sysconfdir is not taken into account
>    by gitweb/Makefile, but perhaps it should.
>  
> Gitweb obtains configuration data from the following sources in the
> following order:
> 
>   1. gitweb's installation configuration file ($GITWEBDIR/gitweb_conf.perl)
>   2. system-wide configuration file (/etc/gitweb.conf)
> 
> First existing config file is used.

Let me see if I understand this correctly: If there is an instance-local configuration file ($GITWEBDIR/gitweb_conf.perl by default) we outright ignore all settings in the system-wide (/etc/gitweb.conf) configuration file? That would mean that the system-wide configuration file isn't really a system-wide set of defaults--to be built upon by a local configuration--at all, but is something much more akin to /etc/skel; used in total or completely overridden.

Coming from the perspective of an administrator of a fair amount of web hosting space I'd actually prefer that it be settable that both the system-wide configuration and the local one affect operation. This would allow for local setting of things such as adding a stylesheet while ensuring consistency otherwise. The order of evaluation of configuration settings sets would be "built-in, system, local" in that case (provided all exist). I can provide a patch to gitweb.perl for that if there is interest.

> Sidenote: we could replace GITWEB_CONFIG and GITWEB_CONFIG_SYSTEM in 
> gitweb.conf.txt during building documentation.

I wasn't sure yet if I wanted to do @@thingy@@ substitution or not. (I'm still not...)

Show 9 quoted lines
> > > +
> > > +The syntax of the configuration files is that of PERL, as these files are
> > > +indeed handled as fragments of PERL code (the language that gitweb itself is
> > > +written in). Variables may be set using "'our $variable = value'"; text from
> > > +"#" character until the end of a line is ignored. See the perlsyn(1) man page
> > > +for more information.
> 
> Actually using 'our $variable = <value>' is a safety check: if newer gitweb
> does no longer use given value, using 'our' wouldn't cause errors.

That was boilerplate language taken pretty directly from the INSTALL and README files. If we change it here we should change it there as well (if it remains once we're done).

> > The perl manual spells the name of that language as "Perl".  

I've seen it spelled all sorts of ugly ways, but if that's what they're using I can too. ;-)

Show 24 quoted lines
> I think
> > it might make sense to mention the syntax earlier, since it makes it
> > less daunting to dive into the file right away.
> 
> I think it might be good idea to provide bare-bones example here.
>  
> > > +
> > > +One good reason to take advatage of the system-wide and local gitweb
> > > +configuration files is that not all settings may be set up directly in the CGI
> > > +itself. Optional features &#8211; defined using the '%features' variable
> > > +&#8211; must be set in one of the two configuration files.
> > 
> > I don't follow what this paragraph is saying.  Is the idea something
> > like this?
> > 
> > 	The default configuration with no configuration file at all
> > 	may work perfectly well for some installations.  Still, a
> > 	configuration file is useful for customizing or tweaking the
> > 	behavior of gitweb in many ways, and some optional features
> > 	will not be present unless explicitly enabled using the
> > 	configurable %features variable.
> 
> I think the idea is that not all of configuration knobs can be tweaked
> during "compile"-time.  Some require setting from configuration file.
Yes, that would benefit from some rewording.
> Note: we probably want to mention gitweb/config.mak or config.mak somewhere
> as place to save build-time configuration, persistently.

Given your preference for keeping gitweb/INSTALL as intact as possible, should that not go there?

Show 14 quoted lines
> > > +
> > > +CONFIGURATION SETTINGS
> > > +----------------------
> > 
> > Configuration settings as opposed to non-configuration settings? :)
> > 
> > Maybe something like
> > 
> > 	VARIABLES
> > 	---------
> > 
> > would be clearer.
> 
> Perhaps.
But variables to do what?
Show 12 quoted lines
> > > +Standard Options
> > > +~~~~~~~~~~~~~~~~~
> > > +The following are not typically set or overridden at build time:
> [...]
> > > +
> > > +$GIT::
> > > +	Core git executable to use.
> > 
> > Ah, what a variable to start with.  Maybe this can be snuck later in
> > the list somehow, so the reader can get to juicier bits first.
> 
> This is set at build time, by default to $(bindir)/git

I chose to leave that in due to the fact that we've had a few threads on the list and other places on the Internet in recent memory where it was asked how to override that. Order is thus far as given in my source materials. If it is set at build time I can move it to the other (non-standard) list.

Show 13 quoted lines
> > > +$version::
> > > +	Gitweb version, set automatically when creating gitweb.cgi from
> > > +	gitweb.perl. You might want to modify it if you are running modified
> > > +	gitweb.
> > 
> > Why would I want to set this in the config file?  Wouldn't my patch to
> > gitweb.cgi modify $version?
> 
> Well, for running gitweb.perl (not build!) from command line I use
> 
>   our $version = "current";
> 
> But this is I think rare case.

I would hope so. In any case, as we part gitweb out I suspect it will be useful to mention somewhere that this is settable, as distribution maintainers are apt to fuss with things (for starters). As far as I'm concerned the README and INSTALL files are fair game for modification if this could be made more clear in one of them.

Show 15 quoted lines
> > > +$projectroot::
> > > +	Absolute filesystem path which will be prepended to project path;
> > > +	the path to repository is `$projectroot/$project`.  Set to
> > > +	`$GITWEB_PROJECTROOT` during installation.  This variable has to be
> > > +	set correctly for gitweb to find repositories.
> > 
> > This is an interesting one.  The description is not so clear to me ---
> > I guess the idea is that if $projectroot = "/srv/git" then
> > 
> >  http://path/to/gitweb/installation/?p=foo/bar.git
> > 
> > will map to /srv/git/foo/bar.git on the filesystem (and likewise for
> > PATH_INFO based URLs)?
> 
> Yes.

This was the one which bit me hard enough to decide to take this task on. I really didn't appreciate having my gitweb and gitolite installations which had been getting along so well suddenly refuse to talk to each other.

Show 23 quoted lines
> > > +$projects_list::
> > > +	Source of projects list, either directory to scan, or text file
> > > +	with list of repositories (in the "`<URI-encoded repository path> SP
> > > +	<URI-encoded repository owner>`" line format; actually there can be
> > > +	any sequence of whitespace in place of space (SP)).  Set to
> > > +	`$GITWEB_LIST` during installation.  If empty, `$projectroot` is used
> > > +	to scan for repositories.
> > 
> > Maybe clearer to emphasize the kinds of values it takes first?  That
> > is:
> > 
> > 	Space-separated list of paths to files listing projects or
> > 	directories to be scanned for projects.  Project list files
> > 	should list one project per line, with each line having the
> > 	format "`<URI-encoded filesystem path to repository> SP
> > 	<URI-encoded repository owner>`.  The default is determined
> > 	by the GITWEB_LIST makefile variable at installation time.
> > 	If this variable is empty, gitweb will fall back to scanning
> > 	the `$projectroot` for repositories.
> 
> I think to not have long wall of text here, we should reference part
> of documentation that explains how gitweb finds repositories, including
> format of $projects_list file.
Perhaps this longer explanation is fodder for gitweb.txt?
Show 14 quoted lines
> > [...]
> > > +Configuration Options Often Set at Compile Time
> > > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > +These configuration variables are often specified at compile time and are
> > > +defined by default in the gitweb CGI itself:
> > > +
> > > +GIT_BINDIR::
> > > +	Points where to find the git executable.  You should set it up to
> > > +	the place where the git binary was installed (usually /usr/bin) if you
> > > +	don't install git from sources together with gitweb.  [Default: $(bindir)]
> > 
> > I don't think there is a GIT_BINDIR configuration variable, though
> > there is a makefile variable with that name used to determine the
> > default value of $GIT.

Ok, upon checking that is indeed "compiled out" during the build process.

> > Likewise for the others.  I don't think they belong in the manpage.
> 
> I agree.  What is important during build time "only" should remain in
> gitweb/INSTALL.

We need to define what that is then, as some of these "build time only" listed values are indeed settable items (granted, once the case is set properly and a dollar sign is prefixed) such as $site_name, $site_header, and $site_footer.

Remember, many people install from packages and not from source. If we make them second-class citizens we only make our lives more difficult.

In any case, as I noted earlier, thus far I've been mostly just pulling stuff in from other places. It is now time to start cleaning it up.

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
J.H.· May 12, 2011, 17:24 UTC · re: Jakub Narebski · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On 05/12/2011 08:01 AM, Jakub Narebski wrote:
Show 11 quoted lines
> On Thu, 12 May 2011, Jonathan Nieder wrote:
>> Drew Northup wrote:
>>
>>> This is a work in progress. Much of what is in it has been pulled
>>> directly from the README and INSTALL files of gitweb. No effort has yet
>>> been made to de-duplicate any of this.
> 
> While it might be a good idea to split main part of gitweb/README into
> gitweb.conf.txt (documenting configuration), and perhaps also separate
> gitweb.txt (main page for gitweb, like SVN::Web manpage), I don't think
> that much of gitweb/INSTALL should be moved.

I would agree with this, if you are shooting for a config file man/txt/html page INSTALL has nothing to do with it, and serves a different purpose.

Show 17 quoted lines
>>> TODO:
>>>   * Clean up README and INSTALL files
>>>   * Add Makefile rules to build man / HTML pages.
>>>   * Remove or rephrase redundant portions of original documentation
>>>   * A lot more...
>>
>> I agree with this TODO list. :)  It should be possible to reuse rules from
>> Documentation/Makefile if you put this under Documentation/.  gitweb already
>> keeps its tests under t/ for convenience; I think it's okay if it
>> puts some documentation under Documentation/.
> 
> Note that git-gui and gitk both also keep their manpages in Documentation/
> as Documentation/git-gui.txt and Documentation/gitk.txt
> 
> We can add "doc" target to gitweb/Makefile, which would delegate work to
> ../Documentation/Makefile, similarly to existing "test" target in
> gitweb/Makefile.

I disagree slightly, I'd personally rather try and keep gitweb more self-contained under gitweb/. I can see the advantage of keeping the docs under Documentation/ but I can also appreciate keeping gitweb self contained, like it is currently.

Show 18 quoted lines
>>> +
>>> +SYNOPSIS
>>> +--------
>>> +/etc/gitweb.conf
> 
> I'd say
> 
>     +SYNOPSIS
>     +--------
>     +gitweb_conf.perl
>     +/etc/gitweb.conf
> 
> or
> 
>     +SYNOPSIS
>     +--------
>     +$GITWEBDIR/gitweb_conf.perl
>     +/etc/gitweb.conf

I'd prefer the later, I don't know of many people who actually use /etc/gitweb.conf, and I'd rather see this be a more generic man page than steering someone who's implementing this to only trying to use /etc/gitweb.conf

Show 7 quoted lines
>> gitweb will also look for gitweb_config.perl along @INC, and
>> the $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM envvars can override
>> these paths.
> 
> I think that we don't need to describe envvars in synopsis, but we
> should have per-gitweb configuration file (gitweb_conf.perl) in
> "Synopsis" section.
That sounds more like an INSTALL thing.
[...]

Beyond that I've no real issue that haven't already been brought up, but I do want to make sure that the ultimate plan here is to add the scripts that generate this vs. the final output, right? I mean we already have 2 places this documentation lives (in gitweb.perl and README), I'm not sure we need a 3rd place to update the documentation at by hand. Just asking.

- John 'Warthog9' Hawley
Drew Northup· May 12, 2011, 18:16 UTC · re: J.H. · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On Thu, 2011-05-12 at 10:24 -0700, J.H. wrote:
Show 14 quoted lines
> On 05/12/2011 08:01 AM, Jakub Narebski wrote:
> > On Thu, 12 May 2011, Jonathan Nieder wrote:
> >> Drew Northup wrote:
> >>
> >>> This is a work in progress. Much of what is in it has been pulled
> >>> directly from the README and INSTALL files of gitweb. No effort has yet
> >>> been made to de-duplicate any of this.
> > 
> > I don't think
> > that much of gitweb/INSTALL should be moved.
> 
> I would agree with this, if you are shooting for a config file
> man/txt/html page INSTALL has nothing to do with it, and serves a
> different purpose.

As noted earlier, we need to make sure that nothing that should be documented as (reasonably) settable during runtime remains in the INSTALL file if that is to be the case. We aren't there yet.

> >>> TODO:
> >>>   * Clean up README and INSTALL files
> >>>   * Add Makefile rules to build man / HTML pages.
> >>>   * Remove or rephrase redundant portions of original documentation
...
Show 7 quoted lines
> 
> Beyond that I've no real issue that haven't already been brought up, but
> I do want to make sure that the ultimate plan here is to add the scripts
> that generate this vs. the final output, right?  I mean we already have
> 2 places this documentation lives (in gitweb.perl and README), I'm not
> sure we need a 3rd place to update the documentation at by hand.  Just
> asking.

I don't think that in the long term it makes sense to leave the README as it is if we are extracting stuff into other files. As for removing documentation lines from the "executable" itself, I'm not going there. (I almost never recommend removing documentation from a program's source text, even when it is excessive.)

This was a FIRST DRAFT. Fun stuff like make scripting and such can start shortly if we continue to think splitting this out into asciidoc is a good idea. (It is sounding like it.) I honestly wasn't planning on a formal v1 without completing (or nearly so) the TODO list above--hence the lack of a sign-off line.

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Jakub Narebski· May 12, 2011, 18:17 UTC · re: J.H. · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On Thu, 12 May 2011, J.H. wrote:
Show 6 quoted lines
> Beyond that I've no real issue that haven't already been brought up, but
> I do want to make sure that the ultimate plan here is to add the scripts
> that generate this vs. the final output, right?  I mean we already have
> 2 places this documentation lives (in gitweb.perl and README), I'm not
> sure we need a 3rd place to update the documentation at by hand.  Just
> asking.

I think the ultimate goal is to move _documentation_ out of gitweb/README (and some from gitweb/INSTALL) to gitweb.txt (or gitweb.pod) and gitweb.conf.txt manpages... so that gitweb/README would be of size of other README's (with sole exception of t/README, which is special case), i.e. up to around 2,300 lines, and not 23,000 lines (10 times more).

-- 
Jakub Narebski
Poland
Jakub Narebski· May 12, 2011, 18:08 UTC · re: Drew Northup · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On Wed, 11 May 2011, Drew Northup wrote:
Show 5 quoted lines
> This is a work in progress. Much of what is in it has been pulled
> directly from the README and INSTALL files of gitweb. No effort has yet
> been made to de-duplicate any of this.
> 
> TODO:
I would add here:
    * Move most of gitweb's README and INSTALL into gitweb.txt and
      gitweb.conf.txt, so that their documentation can be easily viewed.
>   * Clean up README and INSTALL files
This is connected to added point.
>   * Add Makefile rules to build man / HTML pages.

Note that if we decode to go Documentation/gitweb{,.conf}.txt route, i.e. putting docs in Documentation, this point would change to the following:

    * Include gitweb's docs in 'gitweb' package (git.spec.in).
Show changes to diff +7 −3
diff --git i/git.spec.in w/git.spec.in
index 91c8462..06b27eb 100644
--- i/git.spec.in
+++ w/git.spec.in
@@ -200,6 +200,9 @@ rm -rf $RPM_BUILD_ROOT
 %files -n gitweb
 %defattr(-,root,root)
 %{_datadir}/gitweb
+%{!?_without_docs: %{_mandir}/man1/*gitweb*.1*}
+%{!?_without_docs: %{_mandir}/man5/*gitweb*.5*}
+%{!?_without_docs: %doc Documentation/*gitweb*.html }
 
 %files -n perl-Git -f perl-files
 %defattr(-,root,root)


[...]
> If you don't really need (or want) to be on the CC list let me know. You were
> in the output of 'git blame'....

I have culled CC list a bit, please notify if you want to be 
excluded/included.

[Skipping issues mentioned in other subthread]
 
> +DISCUSSION
> +----------
> +
> +The location of `gitweb.conf` is defined at compile time using the
> +configuration value `GITWEB_CONFIG_SYSTEM` and defaults to /etc/gitweb.conf.
> +The name of the per-instance configuration file is defined in gitweb by
> +`GITWEB_CONFIG`.

                 ...and defaults to gitweb_conf.perl.

> +
> +*NOTE:* Values defined in the per-instance configuration file override both
> +values found in the gitweb CGI as well as values found in the system-wide
> +gitweb.conf file.

Actually if there is per-instance configuration file, it is used, and only
otherwise system-wide configuration file is sourced.  But probably that
should be changed:

diff --git i/gitweb/gitweb.perl w/gitweb/gitweb.perl
index acdc5b8..9527cd2 100755
--- i/gitweb/gitweb.perl
+++ w/gitweb/gitweb.perl
@@ -637,12 +637,13 @@ sub evaluate_gitweb_config {
 	our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
 	our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
 	# die if there are errors parsing config file
+	if (-e $GITWEB_CONFIG_SYSTEM) {
+		do $GITWEB_CONFIG_SYSTEM;
+		die $@ if $@;
+	}
 	if (-e $GITWEB_CONFIG) {
 		do $GITWEB_CONFIG;
 		die $@ if $@;
-	} elsif (-e $GITWEB_CONFIG_SYSTEM) {
-		do $GITWEB_CONFIG_SYSTEM;
-		die $@ if $@;
 	}
 }
 

Note: if we change it, we should mention priority of config sources, like
e.g. in ssh_conf(5).

Values in config file override default values found in gitweb sources.

> +
> +The syntax of the configuration files is that of PERL, as these files are
> +indeed handled as fragments of PERL code (the language that gitweb itself is
> +written in). Variables may be set using "'our $variable = value'"; text from
> +"#" character until the end of a line is ignored.

I think it would be nice to have an example here, something like:

-----
our $site_name = 'My Gitweb'; # or 'localhost'
-----

>                                                    See the perlsyn(1) man page 
> +for more information.

Is this how other manpages should be referenced in AsciiDoc?


BTW. What is &#8211;, and could we write it using something more readable?

> +One good reason to take advantage of the system-wide and local gitweb
> +configuration files is that not all settings may be set up directly in the CGI
> +itself. Optional features &#8211; defined using the '%features' variable
> +&#8211; must be set in one of the two configuration files.
> +
> +CONFIGURATION SETTINGS
> +----------------------
> +Standard Options
> +~~~~~~~~~~~~~~~~~
> +The following are not typically set or overridden at build time:

Hmmm... There are four kinds of configuration variables:

1. Variables with default values set during build time

   1.a. Those that usually do not need to be overridden, even if you are
        using packaged gitweb, and do not compile it yourself, like
        e.g. $GIT or $gitweb_js.

   1.b. Those that usually need to be overridden when we cannot control
        build-time configuration, e.g. using gitweb package, like e.g.
        $projectroot.

        If we build gitweb from sources, we can use config.mak or
        gitweb/config.mak to save build time configuration.


2. Variables which cannot be configured during build time

   2.a. Those that gitweb sets automatically, and usually do not need to
        be changed, like e.g. $base_url.

   2.b. Those that need to be set in config file to make use of feature.
        This includes whole %feature-based configuration.


Here there is a table:

  Variable            | type  | build value
  ======================================================================
  $GIT                | 1.a   | "$(bindir)/git"   e.g. "/usr/bin/git"
  $version            | 1.a   | "$(GIT_VERSION)"  e.g. "1.7.5"
  $projectroot        | 1.b !!| "/pub/git"
  $projects_list      | 1.[ab]| "", which means $projectroot
  $my_url, $my_uri    | 2.a   |
  $base_url           | 2.a   |
  $home_link          | 2.a   |
  @stylesheets        | 1.a   | "static/gitweb.css"
  $logo_url           | 2.a ? | "http://git-scm.com/"
  $logo_label         | 2.a ? | "git homepage"
  $projects_list_description_width
                      | 2.b   | 25
  @git_base_url_list  | 1.b   | "", which means no git base url
  $default_blob_plain_mimetype
                      | 2.a   | "text/plain"
  $default_text_plain_charset
                      | 2.b ? | undef
  $mimetypes_file     | 2.b   | undef
  $fallback_encoding  | 2.b   | "latin1"
  @diff_opts          | 2.b   | ('-M')
  $prevent_xss        | 2.b   | 0, which means false
  $maxload            | 2.b   | 300
  $highlight_bin      | 1.[ab]| "highlight"
  $per_request_config |2.b    | 1
  .........................................................................
  $project_maxdepth   | 1.a   | 2007
  $home_link_str      | 1.a ? | "projects"
  $site_name          |[12].a?| ($ENV{'SERVER_NAME'} || "Untitled") . " Git"
  $site_header, $site_footer     
                      | 1.b   | ""
  $home_text          | 1.b   | "indextext.html"
  $logo               | 1.a ? | "static/git-logo.png"
  $favicon            | 1.a ? | "static/git-favicon.png"
  $javascript         | 1.a!  | "static/gitweb.js"
  $default_projects_order
                      | 2.a   | "project"
  $export_ok          | 1.b   | "", which means feature is turned off
  $export_auth_hook   | 2.b   | undef, which means feature is turned off
  $strict_export      | 1.b   | "", which means feature is turned off

> +Configuration Options Often Set at Compile Time
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +These configuration variables are often specified at compile time and are
> +defined by default in the gitweb CGI itself:
> +
> +GIT_BINDIR::
> +	Points where to find the git executable.  You should set it up to
> +	the place where the git binary was installed (usually /usr/bin) if you
> +	don't install git from sources together with gitweb.  [Default: $(bindir)]
[...]

I think this should be left in gitweb/INSTALL, as those are important
_only_ during building gitweb.

> +Configuration File Example
> +~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +To enable blame, pickaxe search, and snapshot support, while allowing
> +individual projects to turn them off, put the following in your
> +GITWEB_CONFIG file:
> +
> +        $feature{'blame'}{'default'} = [1];
> +        $feature{'blame'}{'override'} = 1;

I think this example requires explaining upfront what does it mean to
allow feature override, i.e. about per-repository configuration.
-- 
Jakub Narebski
Poland
Drew Northup· May 12, 2011, 18:33 UTC · re: Jakub Narebski · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On Thu, 2011-05-12 at 20:08 +0200, Jakub Narebski wrote:
> On Wed, 11 May 2011, Drew Northup wrote:
Show 11 quoted lines
> > +
> > +The syntax of the configuration files is that of PERL, as these files are
> > +indeed handled as fragments of PERL code (the language that gitweb itself is
> > +written in). Variables may be set using "'our $variable = value'"; text from
> > +"#" character until the end of a line is ignored.
> 
> I think it would be nice to have an example here, something like:
> 
> -----
> our $site_name = 'My Gitweb'; # or 'localhost'
> -----
Looks reasonable to me...
Show 7 quoted lines
> >                                                    See the perlsyn(1) man page 
> > +for more information.
> 
> Is this how other manpages should be referenced in AsciiDoc?
> 
> 
> BTW. What is &#8211;, and could we write it using something more readable?

That's an en dash. A lot of people write it "blah - blah," but that's not typographically correct (and asciidoc isn't nice enough to fix it for us, as that would likely mess something else up). It compiles properly into both HTML and manpages. I didn't think that dropping the UTF-8 character into the asciidoc sources would go over well.

Show 12 quoted lines
> > +One good reason to take advantage of the system-wide and local gitweb
> > +configuration files is that not all settings may be set up directly in the CGI
> > +itself. Optional features &#8211; defined using the '%features' variable
> > +&#8211; must be set in one of the two configuration files.
> > +
> > +CONFIGURATION SETTINGS
> > +----------------------
> > +Standard Options
> > +~~~~~~~~~~~~~~~~~
> > +The following are not typically set or overridden at build time:
> 
> Hmmm... There are four kinds of configuration variables:
Thank you for this extraction & table.
Show 13 quoted lines
> > +Configuration Options Often Set at Compile Time
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +These configuration variables are often specified at compile time and are
> > +defined by default in the gitweb CGI itself:
> > +
> > +GIT_BINDIR::
> > +	Points where to find the git executable.  You should set it up to
> > +	the place where the git binary was installed (usually /usr/bin) if you
> > +	don't install git from sources together with gitweb.  [Default: $(bindir)]
> [...]
> 
> I think this should be left in gitweb/INSTALL, as those are important
> _only_ during building gitweb.
Understood, I'll have to audit the list for values like that. 
Show 12 quoted lines
> > +Configuration File Example
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +To enable blame, pickaxe search, and snapshot support, while allowing
> > +individual projects to turn them off, put the following in your
> > +GITWEB_CONFIG file:
> > +
> > +        $feature{'blame'}{'default'} = [1];
> > +        $feature{'blame'}{'override'} = 1;
> 
> I think this example requires explaining upfront what does it mean to
> allow feature override, i.e. about per-repository configuration.

Agreed, I was just pulling thing together in this step. I think that there are likely other worthy additions to this portion.

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Jakub Narebski· May 12, 2011, 19:01 UTC · re: Drew Northup · lore

Re: [PATCH/WIP] Starting work on a man page for /etc/gitweb.conf

On Thu, 12 May 2011, Drew Northup wrote:
Show 16 quoted lines
> On Thu, 2011-05-12 at 20:08 +0200, Jakub Narebski wrote:
>> On Wed, 11 May 2011, Drew Northup wrote:
> 
>>> +
>>> +The syntax of the configuration files is that of PERL, as these files are
>>> +indeed handled as fragments of PERL code (the language that gitweb itself is
>>> +written in). Variables may be set using "'our $variable = value'"; text from
>>> +"#" character until the end of a line is ignored.
>> 
>> I think it would be nice to have an example here, something like:
>> 
>> -----
>> our $site_name = 'My Gitweb'; # or 'localhost'
>> -----
> 
> Looks reasonable to me...

Well, this is very much off the cuff example; I hope for a better example, though it doesn't matter much here...

>>>                                                    See the perlsyn(1) man page 
>>> +for more information.
>> 
>> Is this how other manpages should be referenced in AsciiDoc?
Shouldn't we use some 'link:perlsyn[1]' or something like that here?
Show 8 quoted lines
>> 
>> BTW. What is &#8211;, and could we write it using something more readable?
> 
> That's an en dash. A lot of people write it "blah - blah," but that's
> not typographically correct (and asciidoc isn't nice enough to fix it
> for us, as that would likely mess something else up). It compiles
> properly into both HTML and manpages. I didn't think that dropping the
> UTF-8 character into the asciidoc sources would go over well.

Doesn't AsciiDoc convert '--' to en-dash? If not, perhaps adding appropriate definition to Documentation/asciidoc.conf and using "{endash}" instead of "&#8211;" would be a better solution.

Show 9 quoted lines
>>> +CONFIGURATION SETTINGS
>>> +----------------------
>>> +Standard Options
>>> +~~~~~~~~~~~~~~~~~
>>> +The following are not typically set or overridden at build time:
>> 
>> Hmmm... There are four kinds of configuration variables:
> 
> Thank you for this extraction & table.
Note that some of those variables (those below ".....") are not present
in gitweb/README and are not present in your patch.
 
Show 15 quoted lines
>>> +Configuration Options Often Set at Compile Time
>>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> +These configuration variables are often specified at compile time and are
>>> +defined by default in the gitweb CGI itself:
>>> +
>>> +GIT_BINDIR::
>>> +	Points where to find the git executable.  You should set it up to
>>> +	the place where the git binary was installed (usually /usr/bin) if you
>>> +	don't install git from sources together with gitweb.  [Default: $(bindir)]
>> [...]
>> 
>> I think this should be left in gitweb/INSTALL, as those are important
>> _only_ during building gitweb.
> 
> Understood, I'll have to audit the list for values like that. 
I meant here the whole (sub)section.
Show 15 quoted lines
>>> +Configuration File Example
>>> +~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> +
>>> +To enable blame, pickaxe search, and snapshot support, while allowing
>>> +individual projects to turn them off, put the following in your
>>> +GITWEB_CONFIG file:
>>> +
>>> +        $feature{'blame'}{'default'} = [1];
>>> +        $feature{'blame'}{'override'} = 1;
>> 
>> I think this example requires explaining upfront what does it mean to
>> allow feature override, i.e. about per-repository configuration.
> 
> Agreed, I was just pulling thing together in this step. I think that
> there are likely other worthy additions to this portion.

Right, we need some documentation about %feature, like e.g. what does overriding means, and why 'default' needs to be array (currently).

-- 
Jakub Narebski
Poland
Jakub Narebski· May 15, 2011, 10:34 UTC · re: Drew Northup · lore

[RFC/PATCH] gitweb: Starting work on a man page for gitweb (WIP)

Gitweb documentation currently consist of gitweb/README, gitweb/INSTALL and comments in gitweb source code. This is harder to find, use and browse that manpages ("man gitweb" or "git help gitweb") and HTML documentation ("git help --web gitweb").

The goal is to move documentation out of gitweb/README to gitweb.txt and gitweb.conf.txt manpages, reducing its size 10x from around 500 to around 50 lines (two pages), and move information not related drectly to building and installing gitweb out of gitweb/INSTALL there.

To build gitweb documentation you can use
  make -C gitweb doc
or
  cd gitweb; make doc

This is a work in progress. Much of what is in it has been pulled directly from the README and INSTALL files of gitweb. No effort has yet been made to de-duplicate any of this, i.e. to remove contents from gitweb/README and gitweb/INSTALL. The AsciiDoc might (and probably does) contain formatting errors.

Current version is almost direct translation of SVN::Web manpage, and is missing much of information that finally are to be moved from gitweb/README to here.

Inspired-by: Drew Northup <drew.northup@maine.edu>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is intended to go hand in hand with Drew's gitweb.conf.txt (which
probably should also go to Documentation).

The gitweb/Makefile change is here simply to be able to use "make doc" from 'gitweb' directory, and have it work. It would probably be more in line what Documentation/Makefile does.

TODO:
  * Expand gitweb.txt beyond being simple translation of SVN::Web.3pm
    http://p3rl.org/SVN::Web
  * Fix and improve AsciiDoc formatting
  * Clean up gitweb/README and gitweb/INSTALL files
  * Make doc-related part of gitweb/Makefile more robust
  * Remove or rephrase redundant portions of original documentation
  * A lot more...
 Documentation/Makefile   |    2 +-
 Documentation/gitweb.txt |  216 ++++++++++++++++++++++++++++++++++++++++++++++
 git.spec.in              |    3 +
 gitweb/Makefile          |    7 ++
 4 files changed, 227 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/gitweb.txt
Show changes to 4 files +227 −1

Documentation/Makefile, Documentation/gitweb.txt, git.spec.in, gitweb/Makefile

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 36989b7..958c20a 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,7 +1,7 @@
 MAN1_TXT= \
 	$(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
 		$(wildcard git-*.txt)) \
-	gitk.txt git.txt
+	gitk.txt gitweb.txt git.txt
 MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
 	gitrepository-layout.txt
 MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
diff --git a/Documentation/gitweb.txt b/Documentation/gitweb.txt
new file mode 100644
index 0000000..78cee1a
--- /dev/null
+++ b/Documentation/gitweb.txt
@@ -0,0 +1,216 @@
+gitweb(1)
+=========
+
+NAME
+----
+gitweb - Git web interface (web frontend to Git repositories)
+
+SYNOPSIS
+--------
+To get started with gitweb, run linkgit:git-instaweb[1] from a git repository.
+This would configure and start your web server and run web browser pointing to
+gitweb page.
+
+See http://git.kernel.org/?p=git/git.git;a=tree;f=gitweb or
+http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/ for gitweb source code, browsed
+using gitweb.
+
+
+DESCRIPTION
+-----------
+Gitweb provides a web interface to git repositories.  It's features include:
+
+* Viewing multiple Git repositories with common root.
+* Browsing every revision of the repository.
+* Viewing the contents of files in the repository at any revision.
+* Viewing the revision log of branches, history of files and directories,
+  see what was changed when, by who.
+* Viewing the blame/annotation details of any file (if enabled).
+* Generating RSS and Atom feeds of commits, for any branch.
+  The feeds are auto-discoverable in modern web browsers.
+* Viewing everything that was changed in a revision, and step through
+  revisions one at a time, viewing the history of the repository.
+* Finding commits which commit messages matches given search term.
+
+CONFIGURATION
+-------------
+Various aspects of gitweb's behavior can be controlled through the configuration
+file `gitweb_conf.perl` or `/etc/gitweb.conf`.  See the linkgit:gitweb.conf[5]
+for details.
+
+Repositories
+~~~~~~~~~~~~
+Gitweb can show information from one or more Git repositories.  These
+repositories have to be all on local filesystem, and have to share common
+repository root, i.e. be all under a single parent repository.
+
+-----------------------------------------------------------------------
+our $projectroot = '/path/to/parent/directory';
+-----------------------------------------------------------------------
+
+...
+
+ACTIONS, AND URLS
+-----------------
+Gitweb can use path_info (component) based URLs, or it can pass all necessary
+information via query parameters.  The typical gitweb URLs are broken down in to
+five components:
+
+-----------------------------------------------------------------------
+.../gitweb.cgi/<repo>/<action>/<revision>:/<path>?<arguments>
+-----------------------------------------------------------------------
+
+repo::
+	The repository the action will be performed on.
++
+	All actions except for those that list all available projects,
+	in whatever form, require this parameter.
+
+action::
+	The action that will be run.
+
+revision::
+	Revision shown.
+
+path::
+	The path within the <repository> that the action is performed on.
+
+arguments::
+	Any arguments that control the behaviour of the action.
+
+...
+
+Each action is implemented as a subroutine, and must be present in %actions
+hash.  Some actions are disabled by default, and must be turned on via feature
+mechanism.
+
+The standard actions are:
+
+blame::
+blame_incremental::
+	Shows the blame (also called annotation) information for a file. On a
+	per line basis it shows the revision in which that line was last changed
+	and the user that committed the change.
++
+	This action is disabled by default for performance reasons.
+
+blob::
+tree::
+	Shows the files and directories in a given repository path, at given
+	revision.  This is default command if no action is specified in the URL,
+	and path is given.
+
+blob_plain::
+	Returns the raw data for the file in given repository, at given path and
+	revision.  Links to this action are marked 'raw'.
+
+blobdiff::
+	Shows the difference between two revisions of the same file.
+
+project_list::
+	Lists the available Git repositories.  This is the default command if no
+	repository is specified in the URL.
+
+log::
+shortlog::
+	Shows log information (commit message or just commit subject) for a
+	given branch (starting from given revision).
+
+commit::
+commitdiff::
+	Shows information about a specific commit in a repository.
+
+rss::
+atom::
+	Generates an RSS (or Atom) feed of changes to repository.
+
+WEB SERVERS
+-----------
+This section explains how to configure some common webservers to run gitweb. In
+all cases, `/path/to/gitweb` in the examples is the directory you ran installed
+gitweb in, and contains `gitweb_config.perl`.
+
+If you've configured a web server that isn't listed here for gitweb, please send
+in the instructions so they can be included in a future release.
+
+Apache as CGI
+~~~~~~~~~~~~~
+Apache must be configured to support CGI scripts in the directory in
+which gitweb is installed.  Let's assume that it is '/var/www/cgi-bin'
+directory.
+
+-----------------------------------------------------------------------
+ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
+
+<Directory "/var/www/cgi-bin">
+    Options Indexes FollowSymlinks ExecCGI
+    AllowOverride None
+    Order allow,deny
+    Allow from all
+</Directory>
+-----------------------------------------------------------------------
+
+With that configuration the full path to browse repositories would be:
+
+  http://server/cgi-bin/gitweb.cgi
+
+Apache with mod_perl, via ModPerl::Registry
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+You can use mod_perl with gitweb.  You must install Apache::Registry
+(for mod_perl 1.x) or ModPerl::Registry (for mod_perl 2.x) to enable
+this support.
+
+Assuming that gitweb is installed to '/var/www/perl', the following
+Apache configuration is suitable.
+
+-----------------------------------------------------------------------
+Alias /perl "/var/www/perl"
+
+<Directory "/var/www/perl">
+    SetHandler perl-script
+    PerlResponseHandler ModPerl::Registry
+    PerlOptions +ParseHeaders
+    Options Indexes FollowSymlinks +ExecCGI
+    AllowOverride None
+    Order allow,deny
+    Allow from all
+</Directory>
+-----------------------------------------------------------------------
+
+With that configuration the full path to browse repositories would be:
+
+  http://server/perl/gitweb.cgi
+
+Apache with FastCGI
+~~~~~~~~~~~~~~~~~~~
+Gitweb works with Apache and FastCGI.  First you need to rename, copy
+or symlink gitweb.cgi to gitweb.fcgi.  Let's assume that gitweb is
+installed in '/usr/share/gitweb' directory.  The following Apache
+configuration is suitable (UNTESTED!)
+
+-----------------------------------------------------------------------
+FastCgiServer /usr/share/gitweb/gitweb.cgi
+ScriptAlias /gitweb /usr/share/gitweb/gitweb.cgi
+
+Alias /gitweb/static /usr/share/gitweb/static
+<Directory /usr/share/gitweb/static>
+    SetHandler default-handler
+</Directory>
+-----------------------------------------------------------------------
+
+With that configuration the full path to browse repositories would be:
+
+  http://server/gitweb
+
+BUGS
+----
+Please report any bugs or feature requests to git@vger.kernel.org,
+putting "gitweb" somewhere in the subject of email.
+
+SEE ALSO
+--------
+linkgit:gitweb.conf[5], linkgit:git-instaweb[1]
+
+GIT
+---
+Part of the linkgit:git[1] suite
diff --git a/git.spec.in b/git.spec.in
index 91c8462..06b27eb 100644
--- a/git.spec.in
+++ b/git.spec.in
@@ -200,6 +200,9 @@ rm -rf $RPM_BUILD_ROOT
 %files -n gitweb
 %defattr(-,root,root)
 %{_datadir}/gitweb
+%{!?_without_docs: %{_mandir}/man1/*gitweb*.1*}
+%{!?_without_docs: %{_mandir}/man5/*gitweb*.5*}
+%{!?_without_docs: %doc Documentation/*gitweb*.html }
 
 %files -n perl-Git -f perl-files
 %defattr(-,root,root)
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 0a6ac00..945251e 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -112,6 +112,8 @@ endif
 
 GITWEB_FILES += static/git-logo.png static/git-favicon.png
 
+GITWEB_DOC = gitweb.1 gitweb.html
+
 GITWEB_REPLACE = \
 	-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	-e 's|++GIT_BINDIR++|$(bindir)|g' \
@@ -155,6 +157,11 @@ test-installed:
 	GITWEB_TEST_INSTALLED='$(DESTDIR_SQ)$(gitwebdir_SQ)' \
 		$(MAKE) -C ../t gitweb-test
 
+### Documentation
+
+doc:
+	$(MAKE) -C ../Documentation $(GITWEB_DOC)
+
 ### Installation rules
 
 install: all
-- 
1.7.5

← back to recent threads