Issue 371: Support for gitweb alternatives
Status:  Released
Owner: ----
Closed:  Mar 2012

Blocking:
issue 366
Project Member Reported by Shane...@gmail.com, Dec 27, 2009
It would be nice if the support for external gitweb instances could be
extended to allow for other web-based git viewers.

The project I am involved in uses cgit rather than gitweb for our webbased
git viewer which gerrit doesn't support.

It would be nice to be able to define patterns or something in the config
such as:

[gitweb]
	url = http://git.dmdirc.com/cgit.cgi/
	type = cgit

[gitweb "cgit"]
	revision = %project%/commit/%commit%
	project = %project%/summary
	branch = %project%/log/?h=%branch%

or for the default:

[gitweb]
	url = http://git.soren.co.uk/
	type = gitweb # Optional, if not specified use 'gitweb'

[gitweb "gitweb"] # Not really needed, these would be the default values.
	revision = ?p=%project%.git;a=commit;h=%commit%
	project = ?p=%project%.git;a=summary
	branch = ?p=project%.git;a=shortlog;h=%branch%

Here I've suggested using [gitweb "cgit"] and [gitweb "gitweb"] rather than
just putting it into "[gitweb]" to perhaps in future allow different
projects to use different viewers, but I don't know if there is any plans
to allow configuration variations for different projects.

Theres also the option of putting the support for the different types into
the source code (like I have done here:
http://gerrit.dmdirc.com/#change,162) but I think making it configurable is
more useful.
Dec 27, 2009
#1 sop@google.com
We probably should use our PatternString class which uses ${foo} for
string expansions rather than %foo%, because it then matches what
we do in the LDAP section.  But otherwise I agree that we can do a
more generic configuration approach here.

However, gitweb and cgit are the two "top dogs" when it comes to
web based viewers.  They are popular enough that we should have
configuration settings out of the box for them, just like we do with
Active Directory and OpenLDAP when it comes to our LDAP setup.
So I also want to embed the cgit rules into the code.
Status: Accepted
Dec 27, 2009
Project Member #2 Shane...@gmail.com
I wasn't aware of the PatternString class and its uses (having not used LDAP support)
otherwise I would have suggested that as it makes sense to keep everything as similar
as possible.
Dec 27, 2009
Project Member #3 Shane...@gmail.com
I've submitted a patch for this at https://review.source.android.com/13074 (Change-Id
Ic681af1300b9c7cbae1f0f0ce31a5272378feac6).

It adds 4 new settings to the [gitweb] block, `type`, `revision`, `project` and `branch`

type can be either "gitweb", "cgit" or "custom". (If ommited, or blank, "gitweb" is
assumed, anything else will disable the gitweb links)

If custom is used, then patterns must be defined such as:
[gitweb]
  revision = ${project}/commit/?id=${commit}
  project = ${project}/summary
  branch = ${project}/log/?h=${branch}



Dec 28, 2009
#4 sop@google.com
See change Ic681af1300b9c7cbae1f0f0ce31a5272378feac6
Status: Started
Dec 29, 2009
#5 sop@google.com
(No comment was entered for this change.)
Status: Fixed
Labels: FixedIn-2.1.1
Mar 27, 2012
#6 sop@google.com
(No comment was entered for this change.)
Status: Released