Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Auto dive into single level directory trees #8

Closed
spearce opened this issue Dec 1, 2016 · 4 comments
Closed

Auto dive into single level directory trees #8

spearce opened this issue Dec 1, 2016 · 4 comments

Comments

@spearce
Copy link
Contributor

spearce commented Dec 1, 2016

Originally reported on Google Code with ID 8

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.

Reported by None on 2012-11-11 15:33:04

@spearce
Copy link
Contributor Author

spearce commented Dec 1, 2016

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.

Reported by None on 2012-11-11 15:33:04

@spearce
Copy link
Contributor Author

spearce commented Dec 1, 2016

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.

Reported by None on 2012-12-26 11:31:48

@spearce
Copy link
Contributor Author

spearce commented Dec 1, 2016

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

Reported by None on 2012-12-26 17:24:29

@spearce
Copy link
Contributor Author

spearce commented Dec 1, 2016

Fixed in https://gerrit.googlesource.com/gitiles/+/4e8ffd8f4e94585c9f5cae12e14d1c4c92a68659

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.

Reported by None on 2013-01-07 13:24:54

@spearce spearce closed this as completed Dec 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant