git/gitweb
Travor Liu fda513d6fe gitweb: shorten index hashes with trailing file modes
Diff index lines have included a trailing file mode since ec1fcc16af
(Show original and resulting blob object info in diff output,
2005-10-07) when the old and new file modes match:

    index <old>..<new> 100644

gitweb recognizes that trailing mode before it tries to shorten and
link the object IDs.  This appends the file-type annotation first, but
the object-ID matcher requires the ID range to end the line.  As a
result, this common form keeps both full object IDs as plain text.

That is inconsistent with other hash displays and makes commitdiff
output wider than necessary.  Recent gitweb changes have fixed mobile
overflow in log, commit, blob and diff views; leaving two full object
IDs in this header preserves an avoidable long line in the diff header.

* gitweb/gitweb.perl: Remove the trailing mode before matching the index
IDs, then append it again after the IDs have been shortened and linked.
This preserves the mode display while letting ordinary and combined
index lines use the existing object-ID formatting paths.

* t/t9502-gitweb-standalone-parse-output.sh: Add coverage for that
common form by rendering a commitdiff for a regular file modification.
Check that the visible index line contains linked short blob IDs
followed by the mode and file-type annotation, and that the full
unlinked form is not emitted.

Signed-off-by: Travor Liu <travor_lzh@outlook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-17 09:12:59 -07:00
..
static gitweb: let page header grow on mobile for long wrapped project names 2026-02-17 11:49:13 -08:00
GITWEB-BUILD-OPTIONS.in Makefile: extract script to generate gitweb.cgi 2024-12-07 07:52:11 +09:00
INSTALL Merge branch 'js/update-urls-in-doc-and-comment' 2023-12-18 14:10:12 -08:00
Makefile gitweb: fix generation of "gitweb.js" 2025-04-01 02:20:44 -07:00
README
generate-gitweb-cgi.sh Makefile: extract script to generate gitweb.cgi 2024-12-07 07:52:11 +09:00
generate-gitweb-js.sh Makefile: extract script to generate gitweb.js 2024-12-07 07:52:11 +09:00
gitweb.perl gitweb: shorten index hashes with trailing file modes 2026-07-17 09:12:59 -07:00
meson.build meson: distinguish build and target host binaries 2025-04-01 02:20:44 -07:00

README

GIT web Interface
=================

From the git version 1.4.0 gitweb is bundled with git.


Build time gitweb configuration
-------------------------------
There are many configuration variables which affect building gitweb (among
others creating gitweb.cgi out of gitweb.perl by replacing placeholders such
as `++GIT_BINDIR++` by their build-time values).

Building and installing gitweb is described in gitweb's INSTALL file
(in 'gitweb/INSTALL').


Runtime gitweb configuration
----------------------------
Gitweb obtains configuration data from the following sources in the
following order:

1. built-in values (some set during build stage),
2. common system-wide configuration file (`GITWEB_CONFIG_COMMON`,
   defaults to '/etc/gitweb-common.conf'),
3. either per-instance configuration file (`GITWEB_CONFIG`, defaults to
   'gitweb_config.perl' in the same directory as the installed gitweb),
   or if it does not exists then system-wide configuration file
   (`GITWEB_CONFIG_SYSTEM`, defaults to '/etc/gitweb.conf').

Values obtained in later configuration files override values obtained earlier
in above sequence.

You can read defaults in system-wide GITWEB_CONFIG_SYSTEM from GITWEB_CONFIG
by adding

  read_config_file($GITWEB_CONFIG_SYSTEM);

at very beginning of per-instance GITWEB_CONFIG file.  In this case
settings in said per-instance file will override settings from
system-wide configuration file.  Note that read_config_file checks
itself that the $GITWEB_CONFIG_SYSTEM file exists.

The most notable thing that is not configurable at compile time are the
optional features, stored in the '%features' variable.

Ultimate description on how to reconfigure the default features setting
in your `GITWEB_CONFIG` or per-project in `project.git/config` can be found
as comments inside 'gitweb.cgi'.

See also gitweb.conf(5) manpage.


Web server configuration
------------------------
Gitweb can be run as CGI script, as legacy mod_perl application (using
ModPerl::Registry), and as FastCGI script.  You can find some simple examples
in "Example web server configuration" section in INSTALL file for gitweb (in
gitweb/INSTALL).

See "Webserver configuration" and "Advanced web server setup" sections in
gitweb(1) manpage.


AUTHORS
-------
Originally written by:
  Kay Sievers <kay.sievers@vrfy.org>

Any comment/question/concern to:
  Git mailing list <git@vger.kernel.org>