google / gitiles

A simple browser for Git repositories.
https://gerrit.googlesource.com/gitiles/
Other
582 stars 174 forks source link

View /refs/* other than /refs/heads/* and /refs/tags/* #127

Open bungeman opened 6 years ago

bungeman commented 6 years ago

I took a look at RefList.soy and RefServlet.java and there appears to be no good way to explore refs outside of /refs/heads/ and /refs/tags/ . Using /+refs?format=json will dump all of the /refs/* but this isn't exactly discoverable (most don't know about this format). After dumping all the refs to json it is possible to /+/tree-ish to look at the target of the ref, but it would be nice if /+refs/branch-heads/m63 would work directly. This currently won't work because RefServlet.java appears to just up and 404 if anything comes after /+refs .

So this is a request that

  1. /+refs , in addition to showing the Branches and Tags also list the top-level of other refs, for example, something like

Branches master working1

Tags Release 1 Release 2

Other branch-heads/ changes/ pending/ pending-tags/ users/

Where, for example, "branch-heads/" is a link to /+refs/branch-heads/

  1. /+refs/path list any refs directly at refs/path .

Basically, this is a request for (what is conceptually) a directory traversal of refs so that they can all be seen, without having to actually send them all since some ref paths may have a large number of auto generated refs. I realize most projects don't have these other refs, but when they do the lack of discoverability makes working with these refs more difficult than needed. In addition, when these refs do exist they are often needed at inconvenient times and making them easily viewable allows one to quickly confirm the current state of the repo.

jrn commented 6 years ago

Another example: https://gerrit.googlesource.com/gitiles/+refs/changes/ produces a 404 instead of listing refs/changes/*.

Adding support for that kind of URL (and adding the appropriate links to make it discoverable) sounds like a reasonable proposal. I'd be happy to review patches implementing that.

jrn commented 6 years ago

Change under review: https://gerrit-review.googlesource.com/c/gitiles/+/157870