Using gitiles with Gerrit

1,092 views
Skip to first unread message

David Howden

unread,
Jun 27, 2018, 5:50:43 AM6/27/18
to Repo and Gerrit Discussion
Hi,

I'm trying to configure Gitiles to work with Gerrit (using the standard Gitiles plugin).  I'm running Gerrit 2.15.2-4352-g18c7aaba36 and gitiles plugin ec34b9c70a (master).

I'm having a few issues:

(i) Parent commit hashes are not being made into links in the change metadata panel (but should be via [1] (I think)).
(ii) "Links: browse" link in change metadata panel is pointing to https://review.mydomain.com/c//plugins/gitiles/<project>/+/<commit-id> (should be https://review.mydomain.com/plugins/gitiles/<project>/+/<commit-id>). This seems to be an issue with relative URLs in the UI.
(iii) Merged change-set commit hashes ("Merged as <commit-id>", above the change metadata panel) are not being made into links.

Strangely, hitting "browse" on a file within a change set *does* correctly open Gitiles, so it seems like parts of the plugin are working correctly.

With regards to (ii):  There a patch [2] applied to fix issues with Gitiles links not working with the new UI (due to relative paths), so maybe this case is somehow not covered by that.  I've had a look, but I can't see what's wrong.

I have tried creating $SITE_PATH/etc/gitiles.config and adding a baseURL (since I'm using canonicalWebUrl = https://review.mydomain.com in the main gerrit.config):

[gerrit]

... but this did not work either.

Any suggestions from here would be great!  

Thanks,

David.

P.S. I did experiment with adding [gitweb] config params, and links did appear for (i) and (iii) but had the relative-URL issue.  As current versions of the gitiles plugin suggest that the [gitweb] config is not necessary, I abandoned fiddling with that...


Gert van Dijk

unread,
Jun 27, 2018, 6:05:10 AM6/27/18
to Repo and Gerrit Discussion
On Wednesday, 27 June 2018 11:50:43 UTC+2, David Howden wrote:
(ii) "Links: browse" link in change metadata panel is pointing to https://review.mydomain.com/c//plugins/gitiles/<project>/+/<commit-id> (should be https://review.mydomain.com/plugins/gitiles/<project>/+/<commit-id>). This seems to be an issue with relative URLs in the UI.

Strangely, hitting "browse" on a file within a change set *does* correctly open Gitiles, so it seems like parts of the plugin are working correctly.

With regards to (ii):  There a patch [2] applied to fix issues with Gitiles links not working with the new UI (due to relative paths), so maybe this case is somehow not covered by that.  I've had a look, but I can't see what's wrong.

For that issue, see https://bugs.chromium.org/p/gerrit/issues/detail?id=5316#c14 - bug report and the workaround in that comment that works for me.

David Howden

unread,
Jun 27, 2018, 9:44:15 AM6/27/18
to Repo and Gerrit Discussion
Ah, so I should have been more clear, even with the baseURL fix (ii) "Links: browse" doesn't work for me on un-merged changes: it has the relative URL issue (so /c/plugins/gitiles/... instead of just /plugins/gitiles/....).  Only when a change has been merged does it get the correct URL.
Message has been deleted

David Howden

unread,
Jun 27, 2018, 10:07:45 AM6/27/18
to Repo and Gerrit Discussion
OK, so I seem to have actually been fighting some caching whilst experimenting with config options.

It now appears to be working fully (all parts).

The browse links are fixed by setting this (thanks Gert for nudging me to try this again :-)).

[gerrit]

... and the hashes are fixed by adding the following to gerrit.config:

[gitweb] 
    type = custom 
    linkname = gitiles 
    url = https://review.mydomain.com/plugins/gitiles/ 
    revision = ${project}/+/${commit} 
    project = ${project} 
    branch = ${project}/+/${branch} 
    filehistory = ${project}/+log/${branch}/${file} 
    file = ${project}/+/${commit}/${file} 
    roottree = ${project}/+/${commit}/

I think that not all of these options are necessary, will attempt to look at this again tomorrow and work out which ones are actually needed.

However, I suspect that the commit-hash links should not require the [gitweb] config to work, so there is likely something else I've still got wrong.

Thanks,

David.

David Howden

unread,
Jun 29, 2018, 5:27:49 PM6/29/18
to Repo and Gerrit Discussion
It looks like
 
[gitweb] 
    type = custom 
    linkname = gitiles 
    url = https://review.mydomain.com/plugins/gitiles/ 
    revision = ${project}/+/${commit} 

is necessary to get the revision links working?  It seems like the Gitiles plugin should be able to do this without the extra config?
Reply all
Reply to author
Forward
0 new messages