]> Lady’s Gitweb - Gitweb/log
Gitweb
33 hours agogitweb: nagivation menu for tags, heads and remotes
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:12 +0000 (13:26 +0100)]
gitweb: nagivation menu for tags, heads and remotes

tags, heads and remotes are all views that inspect a (particular class
of) refs, so allow the user to easily switch between them by adding
the appropriate navigation submenu to each view.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: separate heads and remotes lists
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:11 +0000 (13:26 +0100)]
gitweb: separate heads and remotes lists

We specialize the 'heads' action to only display local branches, and
introduce a 'remotes' action to display the remote branches (only
available when the remotes_head feature is enabled).

Mirroring this, we also split the heads list in summary view into
local and remote lists, each linking to the appropriate action.

The git_get_heads_list now defaults to 'heads' only, regardless of
whether the remote heads feature is active or not.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: git_get_heads_list accepts an optional list of refs
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:10 +0000 (13:26 +0100)]
gitweb: git_get_heads_list accepts an optional list of refs

git_get_heads_list(limit, class1, class2, ...) can now be used to retrieve
refs/class1, refs/class2 etc. Defaults to ('heads', 'remotes') or ('heads')
depending on whether the 'remote_heads' feature is enabled or not.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: introduce remote_heads feature
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:09 +0000 (13:26 +0100)]
gitweb: introduce remote_heads feature

With this feature enabled, remote heads are retrieved (and displayed)
when getting (and displaying) the heads list. Typical usage would be for
local repository browsing, e.g. by using git-instaweb (or even a more
permanent gitweb setup), to check the repository status and the relation
between tracking branches and the originating remotes.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: use fullname as hash_base in heads link
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:08 +0000 (13:26 +0100)]
gitweb: use fullname as hash_base in heads link

Otherwise, if names are manipulated for display, the link will point to
the wrong head.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Time::HiRes is in core for Perl 5.8
Jakub Narebski [Tue, 9 Nov 2010 18:27:54 +0000 (19:27 +0100)]
gitweb: Time::HiRes is in core for Perl 5.8

We say 'use 5.008' at the beginning of the script, therefore there is no
need to check if Time::HiRes module is available.  We can also import
gettimeofday and tv_interval.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Improve behavior for actionless path_info gitweb URLs
Jakub Narebski [Wed, 13 Oct 2010 11:35:20 +0000 (13:35 +0200)]
gitweb: Improve behavior for actionless path_info gitweb URLs

Eli Barzilay noticed that

  http://server/gitweb/project/<commit-sha1>

link goes to 'shortlog' view, while 'commit' view would be more
useful, but that 'shortlog' action is more apropriate for

  http://server/gitweb/project/<commit-sha1>..<other-commit-sha1>

links.

Therefore for the case when we don't have either action, or filename,
or parent hash [base] in path_info-based URL, i.e. for

  http://server/gitweb/project/<object-id>

link, instead of using 'shortlog' view we allow dispatch() subroutine
to detect type of object and use appropriate action (in most case it
would be either 'commit' action, or 'tag', or 'tree' for top
directory).

Requested-by: Eli Barzilay <redacted>
Signed-off-by: Jakub Narebski <redacted>
Tested-by: Eli Barzilay <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Fix bug in evaluate_path_info
Jakub Narebski [Wed, 13 Oct 2010 11:33:48 +0000 (13:33 +0200)]
gitweb: Fix bug in evaluate_path_info

There was bug in parsing "project/:/file" and "project/:/" path_info
URLs, with implicit HEAD as 'hash_base'.

For such URLs the refname is empty, and before this fix regexp for
parsing path_info fragment assumed that it is always non-empty.

Refname cannot contain ':', as per 'git check-ref-format'.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb/Makefile: Include gitweb/config.mak
Jakub Narebski [Sun, 26 Sep 2010 13:02:24 +0000 (15:02 +0200)]
gitweb/Makefile: Include gitweb/config.mak

Allow for gitweb-specific Makefile config to reside in config.mak file
in the 'gitweb/' subdirectory.  This means that gitweb-specific
build-time configuration variable can reside in gitweb-specific
gitweb/config.mak

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb/Makefile: Add 'test' and 'test-installed' targets
Jakub Narebski [Sun, 26 Sep 2010 13:02:26 +0000 (15:02 +0200)]
gitweb/Makefile: Add 'test' and 'test-installed' targets

The 'test-installed' target in gitweb/Makefile tests installed gitweb,
using the same destination directory that 'install' target uses.

The 'test' target is just a convenience wrapper invoking 'gitweb-test'
target of t/Makefile.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Move call to evaluate_git_version after evaluate_gitweb_config
Jakub Narebski [Sun, 26 Sep 2010 11:34:56 +0000 (13:34 +0200)]
gitweb: Move call to evaluate_git_version after evaluate_gitweb_config

Now evaluate_git_version() is inside run_request() to be called for each
request, instead of once per starting gitweb; this currently matters only
when using FastCGI interface (gitweb.fcgi).

This change was done because evaluate_git_version() uses $GIT variable,
which can be set / modified by gitweb config file, but the variable is
modified this way by gitweb config file used in gitweb tests.  Without
this change there is spurious extra output from t9500 test when tests are
run with '--debug' option.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agoperl: bump the required Perl version to 5.8 from 5.6.[21]
Ævar Arnfjörð Bjarmason [Fri, 24 Sep 2010 20:00:52 +0000 (20:00 +0000)]
perl: bump the required Perl version to 5.8 from 5.6.[21]

Formalize our dependency on perl 5.8, bumped from 5.6.[12]. We already
used the three-arg form of open() which was introduced in 5.6.1, but
t/t9700/test.pl explicitly depended on 5.6.2.

However git-add--interactive.pl has been failing on the 5.6 line since
it was introduced in v1.5.0-rc0~12^2~2 back in 2006 due to this open
syntax:

    sub run_cmd_pipe {
           my $fh = undef;
           open($fh, '-|', @_) or die;
           return <$fh>;
    }

Which when executed dies on "Can't use an undefined value as
filehandle reference". Several of our tests also fail on 5.6 (even
more when compiled with NO_PERL_MAKEMAKER=1):

    t2016-checkout-patch.sh
    t3904-stash-patch.sh
    t3701-add-interactive.sh
    t7105-reset-patch.sh
    t7501-commit.sh
    t9700-perl-git.sh

Our code is bitrotting on 5.6 with no-one interested in fixing it, and
pinning us to such an ancient release of Perl is keeping us from using
useful features introduced in the 5.8 release.

The 5.6 series is now over 10 years old, and the 5.6.2 maintenance
release almost 7. 5.8 on the other hand is more than 8 years old.

All the modern Unix-like operating systems have now upgraded to it or
a later version, and 5.8 packages are available for old IRIX, AIX
Solaris and Tru64 systems.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
Acked-by: Tor Arntsen <redacted>
Acked-by: Randal L. Schwartz <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agoEnable highlight executable path as a configuration option
Christopher Wilson [Tue, 21 Sep 2010 07:25:19 +0000 (00:25 -0700)]
Enable highlight executable path as a configuration option

Allow build-time/run-time configuration of the highlight executable
(must be the one from http://www.andre-simon.de due to assumptions
about parameters and output).  Defaults to previous behavior which
assumes that highlight is available on the server PATH. However, if
this is not the case, the path to the highlight executable can be
configured at build time as a configuration variable

    HIGHLIGHT_BIN = /path/to/highlight

or at runtime by configuring GITWEB_CONFIG

    $highlight_bin = /path/to/highlight

Signed-off-by: Christopher Wilson <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Don't die_error in git_tag after already printing headers
Anders Kaseorg [Fri, 27 Aug 2010 17:38:16 +0000 (13:38 -0400)]
gitweb: Don't die_error in git_tag after already printing headers

This fixes an XML error when visiting a nonexistent tag
(i.e. "../gitweb.cgi?p=git.git;a=tag;h=refs/tags/BADNAME").

Signed-off-by: Anders Kaseorg <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agoTypos in code comments, an error message, documentation
Ralf Wildenhues [Sun, 22 Aug 2010 11:12:12 +0000 (13:12 +0200)]
Typos in code comments, an error message, documentation

Signed-off-by: Ralf Wildenhues <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: clarify search results page when no matching commit found
Jonathan Nieder [Sat, 7 Aug 2010 21:56:47 +0000 (16:56 -0500)]
gitweb: clarify search results page when no matching commit found

When searching commits for a string that never occurs, the results
page looks something like this:

projects / foo.git / search                                 \o/
summary | ... | tree          [commit] search: [ kfjdkas ] [ ]re
first ⋅ prev ⋅ next

Merge branch 'maint'

Foo: a demonstration project

Without a list of hits to compare it to, the header describing the
commit named by the hash parameter (usually HEAD) may itself look
like a hit.  Add some text (“No match.”) to replace the empty
list of hits and avoid this confusion.

While at it, remove some nearby dead code, left behind from a
simplification a few years ago (v1.5.4-rc0~276^2~4, 2007-11-01).

Noticed-by: Erick Mattos <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Fix typo in run() subroutine
Jakub Narebski [Mon, 2 Aug 2010 20:21:47 +0000 (22:21 +0200)]
gitweb: Fix typo in run() subroutine

Run $post_dispatch_hook->() not $pre_dispatch_hook->() after each
request.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: allow configurations that change with each request
Jonathan Nieder [Sat, 31 Jul 2010 03:01:59 +0000 (22:01 -0500)]
gitweb: allow configurations that change with each request

gitolite's contrib/gitweb/gitweb.conf includes:

$ENV{GL_USER} = $cgi->remote_user || "gitweb";

which is useful for setups where a user has to be authenticated
to access certain repos.  Perhaps other typical configurations
change per session in other ways, too.

v1.7.2-rc2~6 (gitweb: Move evaluate_gitweb_config out of run_request,
2010-07-05) broke such configurations for a speedup, by loading
the configuration once per FastCGI process.

Probably in the end there should be a way to specify in the
configuration whether a particular installation wants the speedup or
the flexibility.  But for now it is easier to just undo the relevant
change.

This partially reverts commit 869d58813b24c74e84c9388041eafcef40cb51e4.

Reported-by: Julio Lajara <redacted>
Analysis-by: Jakub Narebski <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: move highlight config out of guess_file_syntax()
Alejandro R. Sedeño [Wed, 28 Jul 2010 18:40:53 +0000 (14:40 -0400)]
gitweb: move highlight config out of guess_file_syntax()

Move highlight config out of guess_file_syntax() so that it can be
extended/overridden by system/user configuration.

Signed-off-by: Alejandro R. Sedeño <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: fix esc_url
Pavan Kumar Sunkara [Thu, 15 Jul 2010 07:29:01 +0000 (12:59 +0530)]
gitweb: fix esc_url

Earlier, 452e225 (gitweb: fix esc_param, 2009-10-13) fixed CGI escaping
rules used in esc_url.  A very similar logic exists in esc_param and needs
to be fixed the same way.

Signed-off-by: Pavan Kumar Sunkara <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Move evaluate_gitweb_config out of run_request
Jakub Narebski [Mon, 5 Jul 2010 18:52:43 +0000 (20:52 +0200)]
gitweb: Move evaluate_gitweb_config out of run_request

Move evaluate_gitweb_config() and evaluate_git_version() out of
run_request() to run(), making them not run one for each request.
This changes how git behaves in FastCGI case.

This change makes it impossible to have config which changes with
request, but I don't think anyone relied on such (hidden action)
behavior.

While at it, reset timer and number of git commands at beginning of
run_request() in new reset_timer() subroutine.  This fixes case when
gitweb was run using FastCGI interface: time is reported for request,
and not for single run of gitweb script.  This changes slightly
behavior in non-FastCGI case: the number of git commands reported is
1 less (running `git --version` one per gitweb is not counted now).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb/Makefile: fix typo in gitweb.min.css rule
Jay Soffian [Fri, 18 Jun 2010 21:01:25 +0000 (17:01 -0400)]
gitweb/Makefile: fix typo in gitweb.min.css rule

This typo has been in place since the rule was originally added by
0e6ce21 (Gitweb: add support for minifying gitweb.css).

Signed-off-by: Jay Soffian <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Return or exit after done serving request
Jakub Narebski [Sun, 13 Jun 2010 10:09:32 +0000 (12:09 +0200)]
gitweb: Return or exit after done serving request

Check if there is a caller in top frame of gitweb, and either 'return'
if gitweb code is wrapped in subroutine, or 'exit' if it is not.

This should avoid

  gitweb.cgi: Subroutine git_SOMETHING redefined at gitweb.cgi line NNN

warnings in error_log when running gitweb with mod_perl (using
ModPerl::Registry handler)

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Fix typo in hash key name in %opts in git_header_html
Jakub Narebski [Sat, 12 Jun 2010 22:35:59 +0000 (00:35 +0200)]
gitweb: Fix typo in hash key name in %opts in git_header_html

The name of the key has to be the same in call site handle_errors_html
and in called subroutine that uses it, i.e. git_header_html.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Run in FastCGI mode if gitweb script has .fcgi extension
Jakub Narebski [Sat, 5 Jun 2010 21:11:18 +0000 (23:11 +0200)]
gitweb: Run in FastCGI mode if gitweb script has .fcgi extension

If the name of the script ($SCRIPT_NAME or $SCRIPT_FILENAME CGI
environment variable, or __FILE__ literal) ends with '.fcgi'
extension, run gitweb in FastCGI mode, as if it was run with
'--fastcgi' / '--fcgi' option.

This is intended for easy deploying gitweb using FastCGI
interface.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Move static files into seperate subdirectory
Pavan Kumar Sunkara [Fri, 28 May 2010 06:25:49 +0000 (11:55 +0530)]
gitweb: Move static files into seperate subdirectory

Create a new subdirectory called 'static' in gitweb/, and move
all static files required by gitweb.cgi when running, which means
styles, images and Javascript code. This should make gitweb more
readable and easier to maintain.

Update t/gitweb-lib.sh to reflect this change.The install-gitweb
now also include moving of static files into 'static' subdirectory
in target directory: update Makefile, gitweb's INSTALL, README and
Makefile accordingly.

Signed-off-by: Pavan Kumar Sunkara <redacted>
Mentored-by: Christian Couder <redacted>
Mentored-by: Petr Baudis <redacted>
Acked-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Use @diff_opts while using format-patch
Pavan Kumar Sunkara [Mon, 10 May 2010 16:41:35 +0000 (18:41 +0200)]
gitweb: Use @diff_opts while using format-patch

Make git-format-patch (used by 'patch' and 'patches' views) use the
same rename detection options that git-diff and git-diff-tree (used
by 'commitdiff', 'blobdiff', etc.) use.

Signed-off-by: Pavan Kumar Sunkara <redacted>
Acked-by: Jakub Narebski <redacted>
Acked-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Add support for FastCGI, using CGI::Fast
Sam Vilain [Fri, 7 May 2010 12:54:05 +0000 (14:54 +0200)]
gitweb: Add support for FastCGI, using CGI::Fast

Former run() subroutine got renamed to run_request().  The new run()
subroutine can run multiple requests at once if run as FastCGI script.

To run gitweb as FastCGI script you must specify '--fastcgi' / '-f'
command line option to gitweb, otherwise it runs as an ordinary CGI
script.

[jn: cherry picked from 56d7d436644ab296155a697552ea1345f2701620
 in http://utsl.gen.nz/gitweb/?p=gitweb which was originally based
 on v264 (2326acfa95ac86a53804ca8eeeb482c2f9265e34) by Kay Sievers;
 updated to reflect current gitweb code]

TODO: update 'gitweb/README' and/or 'gitweb/INSTALL' files.

Signed-off-by: Sam Vilain <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Put all per-connection code in run() subroutine
Jakub Narebski [Fri, 7 May 2010 12:54:04 +0000 (14:54 +0200)]
gitweb: Put all per-connection code in run() subroutine

All code that is run per-connection (as opposed to those parts of gitweb
code that can be run once) is put into appropriate subroutines:
 - evaluate_uri
 - evaluate_gitweb_config
 - evaluate_git_version (here only because $GIT can be set in config)
 - check_loadavg (as soon as possible; $git_version must be defined)
 - evaluate_query_params (counterpart to evaluate_path_info)
 - evaluate_and_validate_params
 - evaluate_git_dir (requires $project)
 - configure_gitweb_features (@snapshot_fmts, $git_avatar)
 - dispatch (includes setting default $action)

The difference is best viewed with '-w', '--ignore-all-space' option,
because of reindent caused by putting code in subroutines.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Refactor syntax highlighting support
Jakub Narebski [Tue, 27 Apr 2010 19:34:45 +0000 (21:34 +0200)]
gitweb: Refactor syntax highlighting support

This refactoring (adding guess_file_syntax and run_highlighter
subroutines) is meant to make it easier in the future to add support
for other syntax highlighing solutions, or make it smarter by not
re-running `git cat-file` second time.

Instead of looping over list of regexps (keys of %highlight_type hash),
make use of the fact that choosing syntax is based either on full
basename (%highlight_basename), or on file extension (%highlight_ext).

Add some basic test of syntax highlighting (with 'highlight' as
prerequisite) to t/t9500-gitweb-standalone-no-errors.sh test.

While at it make git_blob Perl style prettier.

Signed-off-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Syntax highlighting support
Johannes Schindelin [Tue, 27 Apr 2010 19:34:44 +0000 (21:34 +0200)]
gitweb: Syntax highlighting support

It requires the 'highlight' program to do all the heavy-lifting.

This is loosely based on Daniel Svensson's and Sham Chukoury's work in
gitweb-xmms2.git (it cannot be cherry-picked, as gitweb-xmms2 first forked
wildly, then not contributed back, and then went stale).

[jn: cherry picked from bc1ed6aafd9ee4937559535c66c8bddf1864bec6
 in http://repo.or.cz/w/git/dscho.git, with a few changes]

Signed-off-by: Johannes Schindelin <redacted>
Signed-off-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Create install target for gitweb in Makefile
Jakub Narebski [Sat, 1 May 2010 20:36:15 +0000 (22:36 +0200)]
gitweb: Create install target for gitweb in Makefile

Installing gitweb is now as easy as

  # make gitwebdir=/var/www/cgi-bin gitweb-install  ;# as root

The gitweb/INSTALL file was updated accordingly, to make use of this
new target.

Fix shell quoting, i.e. setting bindir_SQ etc., in gitweb/Makefile.
Those variables were not used previously.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Improve installation instructions in gitweb/INSTALL
Jakub Narebski [Tue, 27 Apr 2010 20:45:19 +0000 (22:45 +0200)]
gitweb: Improve installation instructions in gitweb/INSTALL

Signed-off-by: Jakub Narebski <redacted>
Acked-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Silence 'Variable VAR may be unavailable' warnings
Jakub Narebski [Fri, 30 Apr 2010 16:30:31 +0000 (18:30 +0200)]
gitweb: Silence 'Variable VAR may be unavailable' warnings

When $projects_list points to a directory, and git_get_projects_list
scans this directory for repositories, there can be generated the
following warnings (for persistent services like mod_perl or plackup):

  Variable "$project_maxdepth" may be unavailable at gitweb.cgi line 2443.
  Variable "$projectroot" may be unavailable at gitweb.cgi line 2451.

Those are false positives; silence those warnings by explicitely
declaring $project_maxdepth and $projectroot with 'our', as global
variables, in anonymous subrotine passed to File::Find::find.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Move generating page title to separate subroutine
Jakub Narebski [Sat, 24 Apr 2010 14:01:10 +0000 (16:01 +0200)]
gitweb: Move generating page title to separate subroutine

get_page_title subroutine is currently used only in git_header_html.
Nevertheless refactoring title generation allowed to reduce indent
level.

It would be used in more than one callsite in the patch adding caching
activity indicator to gitweb.

Signed-off-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Add custom error handler using die_error
Jakub Narebski [Sat, 24 Apr 2010 14:00:04 +0000 (16:00 +0200)]
gitweb: Add custom error handler using die_error

Change the default message for errors (for fatalsToBrowser) to use
die_error() subroutine.  This way errors (and explicitely calling 'die
MESSAGE') would generate 'Internal Server Error' error message.

Note that call to set_message is intentionally not put in BEGIN block;
we set error handler to use die_error() only after we are sure that we
can use it, after all needed variables are set.

Due to the fact that error handler set via set_message() subroutine
from CGI::Carp (in the fatalsToBrowser case) is called after HTTP
headers were already printed (with exception of MOD_PERL), gitweb
cannot return 'Status: 500 Internal Server Error'.

Thanks to the fact that die_error() no longer uses 'exit', errors
would be logged by CGI::Carp, independent on whether default error
handler is used, or handle_errors_html which uses die_error is used.

Signed-off-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Use nonlocal jump instead of 'exit' in die_error
Jakub Narebski [Sat, 24 Apr 2010 13:56:13 +0000 (15:56 +0200)]
gitweb: Use nonlocal jump instead of 'exit' in die_error

Use 'goto DONE' in place of 'exit' to end request processing in
die_error() subroutine.  While at it, do not end gitweb with 'exit'.

This would make it easier in the future to add support or improve
support for persistent environments such as FastCGI and mod_perl.
It would also make it easier to make use of die_error() as an error
handler (for fatalsToBrowser).

Perl 5 allows non-local jumps; the restriction is that you cannot jump
into a scope.

Signed-off-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: href(..., -path_info => 0|1)
Jakub Narebski [Sat, 24 Apr 2010 13:53:19 +0000 (15:53 +0200)]
gitweb: href(..., -path_info => 0|1)

If named boolean option -path_info is passed to href() subroutine, it
would use its value to decide whether to generate path_info URL form.
If this option is not passed, href() queries 'pathinfo' feature to
check whether to generate path_info URL (if generating path_info link
is possible at all).

href(-replay=>1, -path_info=>0) is meant to be used to generate a key
for caching gitweb output; alternate solution would be to use freeze()
from Storable (core module) on %input_params hash (or its reference),
e.g.:
  $key = freeze \%input_params;
or other serialization of %input_params.

While at it document extra options/flags to href().

Signed-off-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: simplify gitweb.min.* generation and clean-up rules
Junio C Hamano [Thu, 15 Apr 2010 12:57:18 +0000 (08:57 -0400)]
gitweb: simplify gitweb.min.* generation and clean-up rules

GITWEB_CSS and GITWEB_JS are meant to be "what URI should the installed
cgi script use to refer to the stylesheet and JavaScript", never "this
is the name of the file we are building".  Don't use them to decide what
file to build minified versions in.

While we are at it, lose FILES that is used only for "clean" target in a
misguided way.  "make clean" should try to remove all the potential
build artifacts regardless of a minor configuration change. Instead of
trying to remove only the build product "make clean" would have created
if it were run without "clean", explicitly list the three potential build
products for removal.

Tested-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: update INSTALL to use shorter make target
Mark Rada [Sat, 3 Apr 2010 00:37:33 +0000 (20:37 -0400)]
gitweb: update INSTALL to use shorter make target

Gitweb can be generated by the gitweb/gitweb.cgi target or the gitweb
target. Since the gitweb target is shorter, I think it would be better
to have new users be instructed to use it.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: add documentation to INSTALL regarding gitweb.js
Mark Rada [Sat, 3 Apr 2010 00:36:44 +0000 (20:36 -0400)]
gitweb: add documentation to INSTALL regarding gitweb.js

This patch updates gitweb/INSTALL to mention gitweb.js, including
JavaScript minification support.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agoGitweb: add autoconfigure support for minifiers
Mark Rada [Sat, 3 Apr 2010 00:35:54 +0000 (20:35 -0400)]
Gitweb: add autoconfigure support for minifiers

This will allow users to set a JavaScript/CSS minifier when/if they run
the autoconfigure script while building git.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agoGitweb: add support for minifying gitweb.css
Mark Rada [Sat, 3 Apr 2010 00:35:05 +0000 (20:35 -0400)]
Gitweb: add support for minifying gitweb.css

The build system added support minifying gitweb.js through a
JavaScript minifier, but most minifiers come with support for
minifying CSS files as well, so we should use it if we can.

This patch will add the same facilities to gitweb.css that
gitweb.js has for minification. That does not mean that they
will use the same minifier though, as it is not safe to assume
that all JavaScript minifiers will also minify CSS files.

This patch also adds the GITWEB_PROGRAMS variable to the Makefile
to keep a list of potential gitweb dependencies separate from
OTHER_PROGRAMS when we need to know just the gitweb dependencies.

Though the bandwidth savings will not be as dramatic as with
the JavaScript minifier, every byte saved is important.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: git_get_project_config requires only $git_dir, not also $project
Jakub Narebski [Sat, 27 Mar 2010 19:26:59 +0000 (20:26 +0100)]
gitweb: git_get_project_config requires only $git_dir, not also $project

Fix overeager early return in git_get_project_config, introduced in 9be3614
(gitweb: Fix project-specific feature override behavior, 2010-03-01).  When
git_get_project_config is called from projects list page via
git_get_project_owner($path) etc., it is called with $git_dir defined (in
git_get_project_owner($path) etc.), but $project variable is not defined.
git_get_project_config doesn't use $project variable anyway.

Reported-by: Tobias Heinlein <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Fix project-specific feature override behavior
Jakub Narebski [Mon, 1 Mar 2010 21:51:34 +0000 (22:51 +0100)]
gitweb: Fix project-specific feature override behavior

This commit fixes a bug in processing project-specific override in
a situation when there is no project, e.g. for the projects list page.

When 'snapshot' feature had project specific config override enabled
by putting
  $feature{'snapshot'}{'override'} = 1;

(or equivalent) in $GITWEB_CONFIG, and when viewing toplevel gitweb
page, which means the projects list page (to be more exact this
happens for any project-less action), gitweb would put the following
Perl warnings in error log:

  gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2065.
  fatal: error processing config file(s)
  gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2221.
  gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2218.

The problem is in the following fragment of code:

  # path to the current git repository
  our $git_dir;
  $git_dir = "$projectroot/$project" if $project;

  # list of supported snapshot formats
  our @snapshot_fmts = gitweb_get_feature('snapshot');
  @snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);

For the toplevel gitweb page, which is the list of projects, $project is not
defined, therefore neither is $git_dir.  gitweb_get_feature() subroutine
calls git_get_project_config() if project specific override is turned
on... but we don't have project here.

Those errors mentioned above occur in the following fragment of code in
git_get_project_config():

   # get config
   if (!defined $config_file ||
       $config_file ne "$git_dir/config") {
   %config = git_parse_project_config('gitweb');
   $config_file = "$git_dir/config";
   }

git_parse_project_config() calls git_cmd() which has '--git-dir='.$git_dir

There are (at least) three possible solutions:
1. Harden gitweb_get_feature() so that it doesn't call
   git_get_project_config() if $project (and therefore $git_dir) is not
   defined; there is no project for project specific config.
2. Harden git_get_project_config() like you did in your fix, returning early
   if $git_dir is not defined.
3. Harden git_cmd() so that it doesn't add "--git-dir=$git_dir" if $git_dir
   is not defined, and change git_get_project_config() so that it doesn't
   even try to access $git_dir if it is not defined.

This commit implements both 1.) and 2.), i.e. gitweb_get_feature() doesn't
call project-specific override if $git_dir is not defined (if there is no
project), and git_get_project_config() returns early if $git_dir is not
defined.

Add a test for this bug to t/t9500-gitweb-standalone-no-errors.sh test.

Reported-by: Eli Barzilay <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb multiple project roots documentation
Sylvain Rabot [Tue, 2 Mar 2010 00:04:57 +0000 (01:04 +0100)]
gitweb multiple project roots documentation

This commit adds in the gitweb/README file a description of how to use gitweb
with several project roots using apache virtualhost rewrite rules.

Signed-off-by: Sylvain Rabot <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Protect escaping functions against calling on undef
Jakub Narebski [Sun, 7 Feb 2010 20:52:25 +0000 (21:52 +0100)]
gitweb: Protect escaping functions against calling on undef

This is a bit of future-proofing esc_html and friends: when called
with undefined value they would now would return undef... which would
probably mean that error would still occur, but closer to the source
of problem.

This means that we can safely use
  esc_html(shift) || "Internal Server Error"
in die_error() instead of
  esc_html(shift || "Internal Server Error")

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: esc_html (short) error message in die_error
Jakub Narebski [Sun, 7 Feb 2010 20:51:18 +0000 (21:51 +0100)]
gitweb: esc_html (short) error message in die_error

The error message (second argument to die_error) is meant to be short,
one-line text description of given error.  A few callers call
die_error with error message containing unescaped user supplied data
($hash, $file_name).  Instead of forcing callers to escape data,
simply call esc_html on the parameter.

Note that optional third parameter, which contains detailed error
description, is meant to be HTML formatted, and therefore should be
not escaped.

While at it update esc_html synopsis/usage, and bring default error
description to read 'Internal Server Error' (titlecased).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Die if there are parsing errors in config file
Jakub Narebski [Sun, 14 Feb 2010 21:46:28 +0000 (22:46 +0100)]
gitweb: Die if there are parsing errors in config file

Otherwise the errors can propagate, and show in damnest places, and
you would spend your time chasing ghosts instead of debugging real
problem (yes, it is from personal experience).

This follows (parts of) advice in `perldoc -f do` documentation.

This required restructoring code a bit, so we die only if we are reading
(executing) config file.  As a side effect $GITWEB_CONFIG_SYSTEM is always
available, even when we use $GITWEB_CONFIG.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Simplify (and fix) chop_str
John 'Warthog9' Hawley [Wed, 3 Feb 2010 11:28:28 +0000 (12:28 +0100)]
gitweb: Simplify (and fix) chop_str

The chop_str subroutine is meant to be used on strings (such as commit
description / title) *before* HTML escaping, which means before
applying esc_html or equivalent.

Therefore get rid of the failed attempt to always remove full HTML
entities (like e.g. &amp; or &nbsp;).  It is not necessary (HTML
entities gets added later), and it can cause chop_str to chop a string
incorrectly.

Specifically:

     API & protocol: support option to force written data immediately to disk

from http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54

The short version of the title gets chopped to

     API ...

where it should be

     API & protocol: support option to force written data...

Noticed-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Add optional extra parameter to die_error, for extended explanation
John 'Warthog9' Hawley [Sat, 30 Jan 2010 22:30:44 +0000 (23:30 +0100)]
gitweb: Add optional extra parameter to die_error, for extended explanation

Add a 3rd, optional, parameter to die_error to allow for extended error
information to be output along with what the error was.

Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: add a "string" variant of print_sort_th
John 'Warthog9' Hawley [Sat, 30 Jan 2010 22:30:43 +0000 (23:30 +0100)]
gitweb: add a "string" variant of print_sort_th

Add a function (named format_sort_th) that returns the string that
print_sort_th would print.

Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: add a "string" variant of print_local_time
John 'Warthog9' Hawley [Sat, 30 Jan 2010 22:30:42 +0000 (23:30 +0100)]
gitweb: add a "string" variant of print_local_time

Add a function (named format_local_time) that returns the string that
print_local_time would print.

Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Check that $site_header etc. are defined before using them
John 'Warthog9' Hawley [Sat, 30 Jan 2010 22:30:41 +0000 (23:30 +0100)]
gitweb: Check that $site_header etc. are defined before using them

If one of $site_header, $site_footer or $home_text is not defined, you
get extraneous errors in the web logs, for example (line wrapped for
better readibility):

 [Wed Jan 13 16:55:42 2010] [error] [client ::1] [Wed Jan 13 16:55:42 2010]
 gitweb.cgi: Use of uninitialized value $site_header in -f at
 /var/www/gitweb/gitweb.cgi line 3287., referer: http://git/gitweb.cgi

This ensures that those variables are defined before trying to use it.

Note that such error can happen only because of an error in gitweb
config file; building gitweb.cgi can make mentioned variables holding
empty string (it is even the default), but they are still defined.

Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Makefile improvements
John 'Warthog9' Hawley [Sat, 30 Jan 2010 22:30:40 +0000 (23:30 +0100)]
gitweb: Makefile improvements

Adjust the main Makefile so you can simply run

     make gitweb

which in turn calls gitweb/Makefile.  This means that in order to
generate gitweb, you can simply run 'make' from gitweb subdirectory:

     cd gitweb
     make

Targets gitweb/gitweb.cgi and (dependent on JSMIN being defined)
gitweb/gitweb.min.js in main Makefile are preserved for backward
compatibility.

Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Load checking
John 'Warthog9' Hawley [Sat, 30 Jan 2010 22:30:39 +0000 (23:30 +0100)]
gitweb: Load checking

This changes slightly the behavior of gitweb, so that it verifies
that the box isn't inundated with before attempting to serve gitweb.
If the box is overloaded, it basically returns a 503 Server Unavailable
until the load falls below the defined threshold.  This helps dramatically
if you have a box that's I/O bound, reaches a certain load and you
don't want gitweb, the I/O hog that it is, increasing the pain the
server is already undergoing.

This behavior is controlled by $maxload configuration variable.
Default is a load of 300, which for most cases should never be hit.
Unset it (set it to undefined value, i.e. undef) to turn off checking.

Currently it requires that '/proc/loadavg' file exists, otherwise the
load check is bypassed (load is taken to be 0).  So platforms that do
not implement '/proc/loadavg' currently cannot use this feature
(provisions are included for additional checks to be added by others).

There is simple test in t/t9501-gitweb-standalone-http-status.sh to
check that it correctly returns "503 Service Unavailable" if load is
too high, and also if there are any Perl warnings or errors.

Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb.js: Workaround for IE8 bug
Jakub Narebski [Sun, 24 Jan 2010 18:05:23 +0000 (19:05 +0100)]
gitweb.js: Workaround for IE8 bug

In Internet Explorer 8 (IE8) the 'blame_incremental' view, which uses
JavaScript to generate blame info using AJAX, sometimes hang at the
beginning (at 0%) of blaming, e.g. for larger files with long history
like git's own gitweb/gitweb.perl.

The error shown by JavaScript console is "Unspecified error" at char:2
of the following line in gitweb/gitweb.js:

  if (xhr.readyState === 3 && xhr.status !== 200) {

Debugging it using IE8 JScript debuger shown that the error occurs
when trying to access xhr.status (xhr is XMLHttpRequest object).
Watch for xhr object shows 'Unspecified error.' as "value" of
xhr.status, and trying to access xhr.status from console throws error.

This bug is some intermittent bug, depending on XMLHttpRequest timing,
as it doesn't occur in all cases.  It is probably caused by the fact
that handleResponse is called from timer (pollTimer), to work around
the fact that some browsers call onreadystatechange handler only once
for each state change, and not like required for 'blame_incremental'
as soon as new data is available from server.  It looks like xhr
object is not properly initialized; still it is a bug to throw an
error when accessing xhr.status (and not use 'null' or 'undefined' as
value).

Work around this bug in IE8 by using try-catch block when accessing
xhr.status.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Describe (possible) gitweb.js minification in gitweb/README
Jakub Narebski [Wed, 2 Dec 2009 21:14:36 +0000 (22:14 +0100)]
gitweb: Describe (possible) gitweb.js minification in gitweb/README

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Add link to other blame implementation in blame views
Jakub Narebski [Tue, 1 Dec 2009 16:54:26 +0000 (17:54 +0100)]
gitweb: Add link to other blame implementation in blame views

Add link to 'blame_incremental' action (which requires JavaScript) in
'blame' view, and add link to 'blame' action in 'blame_incremental'
view.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Make linking to actions requiring JavaScript a feature
Jakub Narebski [Thu, 26 Nov 2009 20:12:15 +0000 (21:12 +0100)]
gitweb: Make linking to actions requiring JavaScript a feature

Let gitweb turn some links (like 'blame' links) into linking to actions
which require JavaScript (like 'blame_incremental' action) only if
'javascript-actions' feature is enabled.

This means that links to such actions would be present only if both
JavaScript is enabled and 'javascript-actions' feature is enabled.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb.js: fix padLeftStr() and its usage
Stephen Boyd [Wed, 25 Nov 2009 03:51:40 +0000 (19:51 -0800)]
gitweb.js: fix padLeftStr() and its usage

It seems that in Firefox-3.5 inserting &nbsp; with javascript inserts the
literal &nbsp; instead of a space. Fix this by inserting the unicode
representation for &nbsp; instead.

Also fix the off-by-one error in the padding calculation that was
causing one less space to be inserted than was requested by the caller.

Signed-off-by: Stephen Boyd <redacted>
Cc: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb.js: Harden setting blamed commit info in incremental blame
Jakub Narebski [Wed, 25 Nov 2009 00:45:15 +0000 (01:45 +0100)]
gitweb.js: Harden setting blamed commit info in incremental blame

Internet Explorer 8 stops at beginning of blame filling with the
following bug:

  "firstChild is null or not an object"

at this line:

  a_sha1.firstChild.data = commit.sha1.substr(0, 8);

It is (probably) caused by the fact that while a_sha1 element, which
looks like this:

  <a href=""> </a>

It has a firstChild which is a text node containing only whitespace
(single space character) in other web browsers (Firefox 3.5, Opera 10,
Google Chrome 3.0), IE8 clobbers DOM, removing trailing/leading
whitespace.

Protect against this bug by creating text element if it does not
exist.

Found-by: Stephen Boyd <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb.js: fix null object exception in initials calculation
Stephen Boyd [Thu, 19 Nov 2009 19:44:46 +0000 (11:44 -0800)]
gitweb.js: fix null object exception in initials calculation

Currently handleLine() assumes that a commit author name will always
start with a capital letter. It's possible that the author name is
user@example.com and therefore calling a match() on the name will fail
to return any matches. Subsequently joining these matches will cause an
exception. Fix by checking that we have a match before trying to join
the results into a set of initials for the author.

Signed-off-by: Stephen Boyd <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Make 'history' view (re)use git_log_generic()
Jakub Narebski [Fri, 13 Nov 2009 01:02:14 +0000 (02:02 +0100)]
gitweb: Make 'history' view (re)use git_log_generic()

Make git_history use git_log_generic, passing git_history_body as one
of its paramaters.  This required changes to git_log_generic, in
particular passing more things as parameters.

While refactoring common code of 'log', 'shortlog' and 'history' view,
we did unify pagination, using always the form used by 'history' view,
namely
  first * prev * next
in place of
  HEAD * prev * next
used by 'log' and 'shortlog' views.

The 'history' view now supports commit limiting via 'hpb' parameter,
similarly to 'shortlog' (and 'log') view.  Performance of 'history'
view got improved a bit, as it doesn't run git_get_hash_by_path for
"current" version in a loop.  Error detection and reporting for
'history' view changed a bit.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Refactor common parts of 'log' and 'shortlog' views
Jakub Narebski [Fri, 13 Nov 2009 01:02:13 +0000 (02:02 +0100)]
gitweb: Refactor common parts of 'log' and 'shortlog' views

Put the common parts of git_log and git_shortlog into git_log_generic
subroutine: git_log and git_shortlog are now thin wrappers calling
git_log_generic with appropriate arguments.

The unification of code responsible for 'log' and 'shorlog' actions
lead to the following changes in gitweb output
 * 'tree' link in page_nav now uses $hash parameter, as was the case
   for 'shortlog' but not for 'log'
 * 'log' view now respect $hash_parent limiting, like 'shortlog' did
 * 'log' view doesn't have special case for empty list anymore, and it
   always uses page_header linking to summary view, like 'shortlog'
   did.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Refactor 'log' action generation, adding git_log_body()
Jakub Narebski [Fri, 13 Nov 2009 01:02:12 +0000 (02:02 +0100)]
gitweb: Refactor 'log' action generation, adding git_log_body()

Put the main part of 'log' view generation into git_log_body,
similarly how it is done for 'shortlog' and 'history' views (and
also for 'tags' and 'heads' views).

This is preparation for extracting common code between 'log',
'shortlog' and 'history' actions.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Smarter snapshot names
Mark Rada [Sat, 7 Nov 2009 15:13:29 +0000 (16:13 +0100)]
gitweb: Smarter snapshot names

Teach gitweb how to produce nicer snapshot names by only using the
short hash id.  If clients make requests using a tree-ish that is not
a partial or full SHA-1 hash, then the short hash will also be appended
to whatever they asked for.  If clients request snapshot of a tag
(which means that $hash ('h') parameter has 'refs/tags/' prefix),
use only tag name.

Update tests cases in t9502-gitweb-standalone-parse-output.

Gitweb uses the following format for snapshot filenames:
  <sanitized project name>-<version info>.<snapshot suffix>
where <sanitized project name> is project name with '.git' or '/.git'
suffix stripped, unless '.git' is the whole project name.  For
snapshot prefix it uses:
  <sanitized project name>-<version info>/
as compared to <sanitized project name>/ before (without version info).

Current rules for <version info>:
* if 'h' / $hash parameter is SHA-1 or shortened SHA-1, use SHA-1
  shortened to to 7 characters
* otherwise if 'h' / $hash parameter is tag name (it begins with
  'refs/tags/' prefix, use tag name (with 'refs/tags/' stripped
* otherwise if 'h' / $hash parameter starts with 'refs/heads/' prefix,
  strip this prefix, convert '/' into '.', and append shortened SHA-1
  after '-', i.e. use <sanitized hash>-<shortened sha1>

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Fix blob linenr links in pathinfo mode
Petr Baudis [Fri, 6 Nov 2009 15:08:41 +0000 (16:08 +0100)]
gitweb: Fix blob linenr links in pathinfo mode

In pathinfo mode, we use <base href> that refers to the base location
of gitweb in order for various external media links to work well.
However, this means that for the page to refer to itself, it must
regenerate full link, and this is exactly what the blob view page
did not do for line numbers.

Signed-off-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: linkify author/committer names with search
Stephen Boyd [Fri, 16 Oct 2009 04:14:59 +0000 (21:14 -0700)]
gitweb: linkify author/committer names with search

It's nice to search for an author by merely clicking on their name in
gitweb. This is usually faster than selecting the name, copying the
selection, pasting it into the search box, selecting between
author/committer and then hitting enter.

Linkify the avatar icon in log/shortlog view because the icon is directly
adjacent to the name and thus more related. The same is not true
when in commit/tag view where the icon is farther away.

Signed-off-by: Stephen Boyd <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: fix esc_param
Giuseppe Bilotta [Tue, 13 Oct 2009 19:51:36 +0000 (21:51 +0200)]
gitweb: fix esc_param

The custom CGI escaping done in esc_param failed to escape UTF-8
properly. Fix by using CGI::escape on each sequence of matched
characters instead of sprintf()ing a custom escaping for each byte.

Additionally, the space -> + escape was being escaped due to greedy
matching on the first substitution. Fix by adding space to the
list of characters not handled on the first substitution.

Finally, remove an unnecessary escaping of the + sign.

Signed-off-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Do not show 'patch' link for merge commits
Jakub Narebski [Fri, 9 Oct 2009 12:26:44 +0000 (14:26 +0200)]
gitweb: Do not show 'patch' link for merge commits

The 'patch' view is about generating text/plain patch that can be
given to "git am", and "git am" doesn't understand merges anyway.
Therefore link to 'patch' view should not be shown for merge commits.

Also call to git-format-patch inside the 'patch' action would fail
when 'patch' action is called for a merge commit, with "Reading
git-format-patch failed" text as 'patch' view body.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: check given hash before trying to create snapshot
Mark Rada [Sat, 26 Sep 2009 17:46:08 +0000 (13:46 -0400)]
gitweb: check given hash before trying to create snapshot

Makes things nicer in cases when you hand craft the snapshot URL but
make a typo in defining the hash variable (e.g. netx instead of next);
you will now get an error message instead of a broken tarball.

Tests for t9501 are included to demonstrate added functionality.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
33 hours agogitweb: Add 'show-sizes' feature to show blob sizes in tree view
Jakub Narebski [Mon, 7 Sep 2009 12:40:00 +0000 (14:40 +0200)]
gitweb: Add 'show-sizes' feature to show blob sizes in tree view

Add support for 'show-sizes' feature to show (in separate column,
between mode and filename) the size of blobs (files) in the 'tree'
view.  It passes '-l' option to "git ls-tree" invocation.

For the 'tree' and 'commit' (submodule) entries, '-' is shown in place
of size; for generated '..' "up directory" entry nothing is shown.

The 'show-sizes' feature is enabled by default.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Create links leading to 'blame_incremental' using JavaScript
Jakub Narebski [Tue, 1 Sep 2009 11:39:19 +0000 (13:39 +0200)]
gitweb: Create links leading to 'blame_incremental' using JavaScript

The new 'blame_incremental' view requires JavaScript to run.  Not all
web browsers implement JavaScript (e.g. text browsers such as Lynx),
and not all users have JavaScript enabled.  Therefore instead of
unconditionally linking to 'blame_incremental' view, we use JavaScript
to convert those links to lead to view utilizing JavaScript, by adding
'js=1' to link.

Currently the only action that takes 'js=1' into account is 'blame',
which then acts as if it was called as 'blame_incremental' action.
Possible enhancement would be to do JavaScript redirect by setting
window.location instead of modifying $format and $action in
git_blame_common() subroutine.

The only JavaScript-aware/using view is currently 'blame_incremental'.
While at it move reading JavaScript to git_footer_html() subroutine.
Note that in this view we do not add 'js=1' currently (even though
perhaps we should; note that for consistency we should also add 'js=1'
in links added by JavaScript part of 'blame_incremental').

This idea was originally implemented by Petr Baudis in
  http://article.gmane.org/gmane.comp.version-control.git/47614
but it added <script> element with fixBlameLinks() function in page
header, to be added as onload event using 'onload' attribute of HTML
'body' element: <body onload="fixBlameLinks();">.  This version adds
script at then end of page (in the page footer), and uses JavaScript
'window.onload=fixLinks();'.  Also in Petr version only links marked
with 'blamelink' class were modified, and they were modified by
replacing "a=blame" by "a=blame_incremental"... which doesn't work for
path_info links, and might replace wrong part if there is "a=blame" in
project name, ref name or file name.

Slightly different solution was implemented by Martin Koegler in
  http://thread.gmane.org/gmane.comp.version-control.git/47902/focus=47905
Here GitAddLinks() function was in gitweb.js file, not as contents of
<script> element.  It was also included in page header (in <head>
element) though, which means waiting for a script to load (and run).
It was smarter in that to "fix" (modify) link, it split URL, modified
value of 'a' parameter, and then recreated modified link.  It avoids
trouble with "a=blame" as substring in project name or file name, but
it doesn't work with path_info URL/link in the way it was written.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Colorize 'blame_incremental' view during processing
Jakub Narebski [Tue, 1 Sep 2009 11:39:18 +0000 (13:39 +0200)]
gitweb: Colorize 'blame_incremental' view during processing

This requires using 3 colors, not only two, to choose a color that is
different from colors of up to 2 neighbors.

gitweb.js selects the least used color, if more than one color is
possible.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Incremental blame (using JavaScript)
Jakub Narebski [Tue, 1 Sep 2009 11:39:17 +0000 (13:39 +0200)]
gitweb: Incremental blame (using JavaScript)

Add 'blame_incremental' view, which uses "git blame --incremental"
and JavaScript (Ajax), where 'blame' use "git blame --porcelain".

 * gitweb generates initial info by putting file contents (from
   "git cat-file") together with line numbers in blame table
 * then gitweb makes web browser JavaScript engine call startBlame()
   function from gitweb.js
 * startBlame() opens XMLHttpRequest connection to 'blame_data' view,
   which in turn calls "git blame --incremental" for a file, and
   streams output of git-blame to JavaScript (gitweb.js)
 * XMLHttpRequest event handler updates line info in blame view as soon
   as it gets data from 'blame_data' (from server), and it also updates
   progress info
 * when 'blame_data' ends, and gitweb.js finishes updating line info,
   it fixes colors to match (as far as possible) ordinary 'blame' view,
   and updates information about how long it took to generate page.

Gitweb deals with streamed 'blame_data' server errors by displaying
them in the progress info area (just in case).

The 'blame_incremental' view tries to be equivalent to 'blame' action;
there are however a few differences in output between 'blame' and
'blame_incremental' view:

 * 'blame_incremental' always used query form for this part of link(s)
   which is generated by JavaScript code.  The difference is visible
   if we use path_info link (pass some or all arguments in path_info).
   Changing this would require implementing something akin to href()
   subroutine from gitweb.perl in JavaScript (in gitweb.js).
 * 'blame_incremental' always uses "rowspan" attribute, even if
   rowspan="1".  This simplifies code, and is not visible to user.
 * The progress bar and progress info are still there even after
   JavaScript part of 'blame_incremental' finishes work.

Note that currently no link generated by gitweb leads to this new view.

This code is based on patch by Petr Baudis <redacted> patch, which
in turn was tweaked up version of Fredrik Kuivinen <redacted>'s
proof of concept patch.

This patch adds GITWEB_JS compile configuration option, and modifies
git-instaweb.sh to take gitweb.js into account.  The code for
git-instaweb.sh was taken from Pasky's patch.

Signed-off-by: Fredrik Kuivinen <redacted>
Signed-off-by: Petr Baudis <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Add optional "time to generate page" info in footer
Jakub Narebski [Tue, 1 Sep 2009 11:39:16 +0000 (13:39 +0200)]
gitweb: Add optional "time to generate page" info in footer

Add "This page took XXX seconds and Y git commands to generate"
to page footer, if global feature 'timed' is enabled (disabled
by default).  Requires Time::HiRes installed for high precision
'wallclock' time.

Note that Time::HiRes is being required unconditionally; this is
because setting $t0 variable needs to be done fairly early to have
running time of the whole script.  If Time::HiRes module were required
only if 'timed' feature is enabled, the earliest place where starting
time ($t0) could be calculated would be after reading gitweb config,
making "time to generate page" info inaccurate.

This code is based on example code by Petr 'Pasky' Baudis.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agoFix overridable written with an extra 'e'
Nanako Shiraishi [Fri, 28 Aug 2009 03:18:49 +0000 (12:18 +0900)]
Fix overridable written with an extra 'e'

Signed-off-by: Nanako Shiraishi <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: improve snapshot error handling
Mark Rada [Tue, 25 Aug 2009 04:59:48 +0000 (00:59 -0400)]
gitweb: improve snapshot error handling

The last check in the second block of checks in the &git_snapshot routine
is never executed because the second to last check is a superset of the
last check.

Switch the order of the last two checks. It has the advantage of giving
clients a more specific reason why they cannot get a snapshot format if
the format they have chosen is disabled.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: pull ref markes pull out of subject <a> element
Giuseppe Bilotta [Sun, 23 Aug 2009 08:28:09 +0000 (10:28 +0200)]
gitweb: pull ref markes pull out of subject <a> element

Since 4afbaef (gitweb: ref markers link to named shortlogs, 2008-09-02),
ref markers that accompany the subject in views such as shortlog and
history point to something different from the subject itself. Therefore,
they should not be included in the same <a> element.

Benefits of the change are:

 * better compliance to the XHTML standards, that forbid links within
   links even though the restriction cannot be imposed via DTD; this also
   benefits visualization in some older browsers;

 * when hovering the subject, only the subject itself is underlined; when
   hovering the ref markers, only the text in the hovered ref marker is
   underlined; previously, hovering any written part of the subject column
   led to complete underlying of everything at the same time, with
   unpleasing effects.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Optimize git-favicon.png
Benjamin Kramer [Mon, 10 Aug 2009 12:09:00 +0000 (14:09 +0200)]
gitweb: Optimize git-favicon.png

Reduce size of git-favicon.png using a combination of optipng and
pngout. From 164 bytes to 115 bytes (30% reduction). Also reduce
git-logo.png's size by one byte using advcomp.

Signed-off-by: Benjamin Kramer <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: add support for XZ compressed snapshots
Mark A Rada [Thu, 6 Aug 2009 14:28:25 +0000 (10:28 -0400)]
gitweb: add support for XZ compressed snapshots

The XZ compression format uses the LZMA2 compression algorithm, which
often yields higher compression ratios than both GZip and BZip2 at the
cost of using more CPU time and RAM. XZ is the slowest for compression,
but still much faster than BZip2 for decompression, almost comparable
to GZip (see benchmarks below).

Some simple benchmarks show the pros and cons of using XZ compression;
starting with an already tarball'd archive of the repos listed below.
Memory usage seemed to be consistent for any given algorithm at their
respective default compression levels.

CPU: AMD Sempron 3400+ (1 core @ 1.8GHz with 256K L2 cache)
Virtual Memory Usage
       GZip: 4152K        BZip2: 13352K        XZ: 102M

Linux 2.6 series (f5886c7f96f2542382d3a983c5f13e03d7fc5259)  349M
gzip    23.70s user   0.47s system  99% cpu   24.227 total    76M
gunzip  3.74s user    0.74s system  94% cpu   4.741 total
bzip2   130.96s user  0.53s system  99% cpu   2:11.97 total   59M
bunzip2 31.05s user   1.02s system  99% cpu   32.355 total
xz      448.78s user  0.91s system  99% cpu   7:31.28 total   51M
unxz    7.67s user    0.80s system  98% cpu   8.607 total

Git (0a53e9ddeaddad63ad106860237bbf53411d11a7)                11M
gzip    0.77s user    0.03s system  99% cpu   0.792 total    2.5M
gunzip  0.12s user    0.02s system  98% cpu   0.142 total
bzip2   3.42s user    0.02s system  99% cpu   3.454 total    2.1M
bunzip2 0.95s user    0.03s system  99% cpu   0.984 total
xz      12.88s user   0.14s system  98% cpu   13.239 total   1.9M
unxz    0.27s user    0.03s system  99% cpu   0.298 total

XZ (669413bb2db954bbfde3c4542fddbbab53891eb4)                1.8M
gzip    0.12s user    0.00s system  95% cpu   0.132 total    442K
gunzip  0.02s user    0.00s system  97% cpu   0.027 total
bzip2   1.28s user    0.01s system  99% cpu   1.298 total    363K
bunzip2 0.15s user    0.01s system  100% cpu  0.157 total
xz      1.62s user    0.03s system  99% cpu   1.652 total    347K
unxz    0.05s user    0.00s system  99% cpu   0.058 total

From a time and memory perspective, nothing compares to GZip, but if
given an average upload speed of 20KB/s, it would take ~400 seconds
longer to transfer the BZip2'd kernel snapshot than the XZ snapshot;
the transfer time difference is even greater between GZip and XZ. The
real time savings are relatively the same for all test cases, but less
dramatic for smaller repositories.

XZ decompresses ~1.8-2 times slower than GZip, and ~2.7-3.75 times
faster than BZip2; XZ gets relatively faster as snapshots get larger.
However, XZ takes relatively longer to compress as snapshots get larger.

The downside for XZ'd snapshots is the large CPU and memory load put on
the server to generate the compressed snapshot, though XZ will
eventually
have threading support, and the real clock time for making XZ'd
snapshots
would decrease if the server had a beefy multi-core CPU.

XZ compression is disabled by default to allow upgrades to take place
without any surprises, as the CPU and memory requirements will be an
issue for high load or lightweight servers. Also, the XZ format is still
new (format declared stable ~6 months ago), and there have been no
"stable" releases of the utils yet.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: update INSTALL regarding specific snapshot settings
Mark A Rada [Thu, 6 Aug 2009 14:27:26 +0000 (10:27 -0400)]
gitweb: update INSTALL regarding specific snapshot settings

This includes instructions on how to disable a snapshot format and how
to add options to a snapshot format (e.g. setting the compression
level).

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: support to globally disable a snapshot format
Mark A Rada [Thu, 6 Aug 2009 14:25:39 +0000 (10:25 -0400)]
gitweb: support to globally disable a snapshot format

Allow Gitweb administrators to set a 'disabled' key in the
%known_snapshot_formats hash to disable a specific snapshot format.

All formats are enabled by default to maintain backwards compatibility.

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: parse_commit_text encoding fix
Zoltán Füzesi [Sun, 2 Aug 2009 07:42:24 +0000 (09:42 +0200)]
gitweb: parse_commit_text encoding fix

Call to_utf8 when parsing author and committer names, otherwise they will appear
with bad encoding if they written by using chop_and_escape_str.

Signed-off-by: Zoltán Füzesi <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb/README: Document $base_url
Jakub Narebski [Tue, 4 Aug 2009 15:54:32 +0000 (17:54 +0200)]
gitweb/README: Document $base_url

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: fix 'Use of uninitialized value' error in href()
Giuseppe Bilotta [Fri, 31 Jul 2009 06:48:49 +0000 (08:48 +0200)]
gitweb: fix 'Use of uninitialized value' error in href()

Equality between file_parent and file_name was being checked without a
preliminary check for existence of the parameters.

Fix by wrapping the equality check in appropriate if (defined ...),
rearranging the lines to prevent excessive length.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Use light/dark for class names also in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:06 +0000 (00:44 +0200)]
gitweb: Use light/dark for class names also in 'blame' view

Instead of using "light2" and "dark2" for class names in 'blame' view
(in place of "light" and "dark" classes in other places) to avoid
changing style on hover in 'blame' view while doing it for other views
(like 'shortlog'), use more advanced CSS, relying on the fact that
more specific selector wins.

While at it add a few comments to gitweb CSS file, and consolidate
some repeated info.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Add author initials in 'blame' view, a la "git gui blame"
Jakub Narebski [Fri, 24 Jul 2009 22:44:05 +0000 (00:44 +0200)]
gitweb: Add author initials in 'blame' view, a la "git gui blame"

For example for "Junio C Hamano" initials would be "JH".  Of course
initials are added (below shortened SHA-1 of blamed commit) only if
group of lines that blame the same commit has 2 or more lines in it.

Initials are extracted using i18n /\b([[:upper:]])\B/g regexp.

Additionally initials help to distinguish boundary commits, as they
use bold weight font too (in addition to shortened SHA-1 of commit).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Mark commits with no "previous" in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:04 +0000 (00:44 +0200)]
gitweb: Mark commits with no "previous" in 'blame' view

Use "no-previous" class to mark blamed commits which do not have
"previous" header.  Those are commits in which blamed file was created
(added); this includes boundary commits.  This means that 'linenr'
link leads to blamed commit, not (one of) parent of blamed commit.
Therefore currently line number for such commit uses bold weight font
to denote this situation; the effect is subtle.

Use "multiple-previous" class in the opposite situation, where blamed
commit has multiple "previous" headers (is an evil merge).  Currently
this class is not used for styling.  In this situation 'linenr' link
leads to first of "previous" commits (first parent).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Use "previous" header of git-blame -p in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:03 +0000 (00:44 +0200)]
gitweb: Use "previous" header of git-blame -p in 'blame' view

Luben Tuikov changed 'lineno' link (line number link) from pointing to
'blame' view at given line at blamed commit, to the one at parent of
blamed commit in
  244a70e (Blame "linenr" link jumps to previous state at
           "orig_lineno", 2007-01-04).
This made it possible to do data mining using 'blame' view, by going
through history of a line using mentioned line number link.

Original implementation called "git rev-parse <commit>^" to find SHA-1
of a parent of a given commit once per each blamed line.  In
  39c19ce (gitweb: cache $parent_commit info in git_blame(),
           2008-12-11)
this was improved so rev-parse was called once per each unique commit
in git-blame output.  Alternate solution would be to relax validation
for 'hb' parameter by allowing extended SHA-1 syntax of the form
<rev>^ (perhaps redirecting to gitweb URL with <rev>^ resolved, in
practice moving call to rev-parse to 'the other side of link').

This solution had a bug that it didn't work for boundary commits.
Boundary commits don't have parents, so "git rev-parse <commit>^"
returned literal "<commit>^" (which didn't exists).  Gitweb didn't
detect this situation and passed this result literally as 'hb'
parameter in 'linenr' link.  Following such link currently gives
  400 - Invalid hash base parameter
error; 'hb' parameter is restricted via validate_refname to correct
refnames and doesn't allow for extended SHA-1 syntax.  This bug could
have been fixed alternatively by checking if commit is boundary commit,
or check if rev-parse result is unchanged (still ends in '^' prefix).

The solution employing rev-parse to find parent of commit had inherent
problem if blamed commit renamed file; then name of file would be
different in its parent.  Solving this outside git-blame would be
difficult and costly (at least cost of additional fork for extra git
command).

Currently gitweb uses information in "previous" header, which was
introduced by Junio C Hamano in
  96e1170 (blame: show "previous" information in
           --porcelain/--incremental format, 2008-06-04)
This (currently undocumented) header has the following format:
  "previous <sha1 of parent commit> <filename at parent>"
Using "previous" header solves both problem of performance and the
problem that blamed commit could have renaming blamed file.

Because "previous" header can be repeated for the same commit when
blamed commit is merge (has more than one parent), and we are
interested usually in _first_ parent, currently we store only first
value if blame header repeats.  Using first parent (first "previous"
line) was what gitweb did before; without this change gitweb would use
last parent instead.

If there is no previous commit 'linenr' link points to blamed commit
and blamed filename, making it work correctly for boundary commits.

Acked-by: Luben Tuikov <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Mark boundary commits in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:02 +0000 (00:44 +0200)]
gitweb: Mark boundary commits in 'blame' view

Use "boundary" class to mark boundary commits, which currently results
in using bold weight font for SHA-1 of a commit (to be more exact for
all text in the first cell in row, that contains SHA-1 of a commit).

Detecting boundary commits is done by watching for "boundary" header
in "git blame -p" output.  Because this header doesn't carry
additional data the regular expression for blame header fields
had to be slightly adjusted.

With current gitweb API only root (parentless) commits can be boundary
commits.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: Make .error style generic
Jakub Narebski [Fri, 24 Jul 2009 22:44:01 +0000 (00:44 +0200)]
gitweb: Make .error style generic

Style for td.error was introduced in 1f1ab5f (gitweb: style done with
stylesheet, 2006-06-20) to replace inline style for errors in old
multi-column "git annotate" based 'blame' view.  This view was then
since removed (replaced by "git-blame" based 'blame' view, with fewer
colums), making this style unused.

Make this style more generic by replacing td.error with .error to make
it apply to any element.  It will be used in 'blame_incremental' view
to show error messages.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: update Git homepage URL
Wincent Colaiuta [Sun, 12 Jul 2009 12:31:28 +0000 (14:31 +0200)]
gitweb: update Git homepage URL

git-scm.com is now the "official" Git project page, having taken over
from git.or.cz, so update the default link accordingly. This saves a
redirect when people hit git.or.cz.

Signed-off-by: Wincent Colaiuta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: add empty alt text to avatar img
Giuseppe Bilotta [Mon, 29 Jun 2009 22:00:54 +0000 (00:00 +0200)]
gitweb: add empty alt text to avatar img

The empty alt text optimizes screen estate in text-only browsers.

Signed-off-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: picon avatar provider
Giuseppe Bilotta [Mon, 29 Jun 2009 22:00:53 +0000 (00:00 +0200)]
gitweb: picon avatar provider

Simple implementation of picon that only relies on the indiana.edu
database.

Signed-off-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: gravatar url cache
Giuseppe Bilotta [Mon, 29 Jun 2009 22:00:52 +0000 (00:00 +0200)]
gitweb: gravatar url cache

Views which contain many occurrences of the same email address (e.g.
shortlog view) benefit from not having to recalculate the MD5 of the
email address every time.

Signed-off-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: (gr)avatar support
Giuseppe Bilotta [Mon, 29 Jun 2009 22:00:51 +0000 (00:00 +0200)]
gitweb: (gr)avatar support

Introduce avatar support: the feature adds the appropriate img tag next
to author and committer in commit(diff), history, shortlog, log and tag
views. Multiple avatar providers are possible, but only gravatar is
implemented at the moment.

Gravatar support depends on Digest::MD5, which is a core package since
Perl 5.8. If gravatars are activated but Digest::MD5 cannot be found,
the feature will be automatically disabled.

No avatar provider is selected by default, except in the t9500 test.

Signed-off-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: use git_print_authorship_rows in 'tag' view too
Giuseppe Bilotta [Mon, 29 Jun 2009 22:00:50 +0000 (00:00 +0200)]
gitweb: use git_print_authorship_rows in 'tag' view too

parse_tag must be adapted to use the hash keys expected by
git_print_authorship_rows. This is not a problem since git_tag is the
only user of this sub.

Signed-off-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
33 hours agogitweb: uniform author info for commit and commitdiff
Giuseppe Bilotta [Mon, 29 Jun 2009 22:00:49 +0000 (00:00 +0200)]
gitweb: uniform author info for commit and commitdiff

Switch from 'log'-like layout

    A U Thor <redacted> [date time]

to 'commit'-like layout

    author    A U Thor <redacted>
              date time
    committer C O Mitter <redacted>
              committer date time

Signed-off-by: Giuseppe Bilotta <redacted>
Signed-off-by: Junio C Hamano <redacted>
This page took 0.914941 seconds and 4 git commands to generate.