Subject: Re: RFD: Shipping GitBrowser.js for instaweb

From: Jakub Narebski <[email-masked]>
Date: Mon, 3 May 2010 21:12:09 +0200

On Mon, 3 May 2010, Michael J Gruber wrote:
> Jakub Narebski venit, vidit, dixit 02.05.2010 22:14:
>> Michael J Gruber <[email-masked]> writes:
>> 
>>> I was wondering whether it would make sense to ship GitBrowser.js with
>>> Git and how much it would take to do so.
>>>
>>> My personal answer to the 1st Q is Yes: instaweb as well as simple
>>> gitweb installs would benefit from a graphical DAG viewer.
>>>
>>> About the required effort I have no clue: I find it difficult to see
>>> through which repo contains current gitweb, current repo.or.cz mods, and
>>> especially the GitBrowser integration bits. Maybe we could ship the
>>> integration bits without the actual GitBrowser if that is more feasible?
>> 
>> The integration parts are actually present in gitweb, I think.  It is
>> a matter of configuration to enable 'graphiclog' link like in
>> http://repo.or.cz
>> 
>> GitBrowser.js is not, I think, the best solution for having graphical
>> history in gitweb, but would do...
> 
> After having a more thorough look at it I agree... We don't want to
> inflate $GIT_DIR/gitweb more than necessary.

Especially that GitBrowser.js (git-browser) does drawing in *JavaScript*,
and requires (included) extra wz_jsgraphics.js JavaScript library
(Walter Zorn's High Performance JavaScript Graphics Library).

> 
> But what are the alternatives? Something svg/canvas would be nice, I
> guess. The ruby frontends with graphlog don't convince me at all
> (neither performance-wise nor layout-wise).

1. Using SVG/canvas (probably with Flash as fallback for those web 
   browser that do not have support for canvas element and/or SVN)
   seems like overkill for gitk / qgit / "git log --graph" equivalent
   for gitweb... well, unless for something like interactive 'Network'
   graph on GitHub, see e.g. http://github.com/jquery/jquery/network

2. Gitweb could generate required images on-the-fly using one of graphics
   modules like GD (uses gd library), Imaginer, or Image::Imlib2 (uses
   imlib2 library).  GD is, I think, most commonly used and available.
   We would want to make it conditional on GD (and gd library) being
   available.

3. Gitweb could use some ready images, which would be composed to form
   graphical representation of history; it would probably use CSS to
   change color (and require support for opacity in CSS or transparent
   layer in PNG).  See also 4.

4. Gitweb could use Unicode characters for tree graphics like git-forest
   (http://dev.medozas.de/gitweb.cgi?p=hxtools;a=blob_plain;f=bin/git-forest)
   does (I think it uses box drawing characters U+2500-257F).  We could
   even borrow some code from git-forest, which is also in Perl 
   (by Jan Engelhardt).

5. Gitweb could use ASCII-art for drawing history, like "git log --graph"
   does... perhaps even by directly using (and probably postprocessing)
   git-log / git-rev-list output with the '--graph' option.  It could
   change (transform) ASCII-art to Unicode box drawing characters.

-- 
Jakub Narebski
Poland