ui-repolist: Allow sections to be collapsible

The index page can be difficult to navigate for really large git
servers. This change allows a configuration like:

 section-collapse=people
 section-collapse=tests

And an index page would only display the "people" and "tests" section
headers entries (not their repos) with a hyperlink that can be used to
drill down into each section.

Additionally the boolean logic around displaying sections in
ui-repolist.c was simplified to eliminate an impossible condition.

Signed-off-by: Andy Doan <andy.doan@linaro.org>
Reviewed-by: John Keeping <john@keeping.me.uk>
Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
Andy Doan 2016-09-12 22:54:08 -05:00 committed by John Keeping
parent 84b158abe0
commit 1a66e7f3c1
6 changed files with 63 additions and 24 deletions

View file

@ -164,10 +164,10 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
}
if (slash && !n) {
*slash = '\0';
repo->section = xstrdup(rel.buf);
repo->section = get_or_create_section(rel.buf);
*slash = '/';
if (starts_with(repo->name, repo->section)) {
repo->name += strlen(repo->section);
if (starts_with(repo->name, repo->section->name)) {
repo->name += strlen(repo->section->name);
if (*repo->name == '/')
repo->name++;
}