Files
gerrit/contrib/gitiles
Saša Živkov 40839ea8d4 gitiles script to generate/open gitiles URLs
We often use gitiles links to point to some source code which is
relevant for a discussion or code review. It often requires 10-15
mouse clicks in order to navigate to a path in gitiles and generate a
link. This is cumbersome and may discourage providing links to gitiles.

This script intends to provide a fast way to generate and open gitiles
links. It requires a one time setup of gitiles.url in .git/config file:

  [gitiles]
    url = https://gerrit.googlesource.com/gerrit

Once gitiles.url is setup we can generate gitiles URLs easily.

Examples
========

* print gitiles URL for the current HEAD and current directory:

  $ gitiles
  https://gerrit.googlesource.com/gerrit/+/d685ac1193e086b896cfc019ef4504d1b7ce455b/

* print gitiles URL for current HEAD and Documentation directory:

  $ gitiles Documentation

* print gitiles URL for branch stable-2.15 and current directory:

  $ gitiles -b stable-2.15

* print gitiles URL for current HEAD and a path relative to the current directory:

  $ pwd
  gerrit-server
  $ gitiles ./src/main/resources

The script also supports "open" command which open gitiles URL using
OS's native way of opening URLs:

  $ gitiles open
  $ gitiles open -b stable-2.15 Documentation

Change-Id: Icd31723711535e886313d3d17afb57caa4a710b1
2018-03-07 19:13:56 +00:00

1.5 KiB
Executable File