joebubba / gitiles

Automatically exported from code.google.com/p/gitiles
0 stars 0 forks source link

Auto dive into single level directory trees #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Follow a single level directory tree down to its first subtree that has more 
than one child.

In this page:

 https://gerrit.googlesource.com/gerrit/+/master/gerrit-patch-jgit

clicking on "src/" should take me to:

 https://gerrit.googlesource.com/gerrit/+/master/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/

and not the fairly useless:

 https://gerrit.googlesource.com/gerrit/+/master/gerrit-patch-jgit/src/

This is tricky because we don't want to inflate each subtree when looking at 
the parent just to find out if its got >1 child or not. If we have the src/ URL 
just redirect when it finds itself in this case, you can't view src/ by itself 
anymore in the breadcrumb trail. Maybe we could force it to *not* auto-dive by 
putting a special URL in the breadcrumb trail when we know the parent has only 
one child, and skip the redirect for src/ if the URL was actually src/. (the 
illegal trailing single dot meaning show self and disable auto-dive).

This feature is primarily useful for Java projects like Gerrit where the 
package structure is really deep and single foldery all the way down. Its less 
useful on things like the kernel that have a sane directory tree layout.

Original issue reported on code.google.com by dborowitz@google.com on 11 Nov 2012 at 11:33

GoogleCodeExporter commented 8 years ago
My plan is to have /src/. not auto-dive, and to hack the breadcrumbs to add 
that only for those paths where necessary. It's a bit ugly because the 
breadcrumb URL generating code is a pure function of the current URL, so the 
"auto-dive root" has to be passed in, which complicates the initial TreeWalk 
setup. But not impossible.

Original comment by dborowitz@google.com on 26 Dec 2012 at 7:31

GoogleCodeExporter commented 8 years ago
Well so much for "/src/."; Chrome normalizes this URL to "/src/". I'm open to 
other suggestions. Query parameters suck.

Original comment by dborowitz@google.com on 27 Dec 2012 at 1:24

GoogleCodeExporter commented 8 years ago
Fixed in 
https://gerrit.googlesource.com/gitiles/+/4e8ffd8f4e94585c9f5cae12e14d1c4c92a686
59

Query parameters still suck. The rationalization for keeping this is nobody 
really needs to be able to predict/type these URLs manually. If someone really 
means to link to /foo/src/main/java/com, they can type it in, see that it 
auto-dives, and copy the URL out of the breadcrumbs.

Original comment by dborowitz@google.com on 7 Jan 2013 at 9:24