From mboxrd@z Thu Jan 1 00:00:00 1970 From: petr.vorel at gmail.com (Petr Vorel) Date: Thu, 28 Apr 2016 22:37:29 +0200 Subject: [PATCH] ui-shared: split repository link into directories Message-ID: <1461875849-28553-1-git-send-email-petr.vorel@gmail.com> Signed-off-by: Petr Vorel --- The only missing feature from gitweb: clickable any directory in between. It's very handy, if you have lots of repos (local AOSP repositories). If you don't like it hardcoded, I can prepare patch with configuration option. --- ui-shared.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index 9a38aa9..cac12bf 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -937,7 +937,24 @@ static void print_header(void) if (ctx.repo) { cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); html(" : "); - cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); + + char *token, *saveptr, *delim = "/"; + char dir[strlen(ctx.repo->name)]; + char link[strlen(ctx.repo->name)]; + strcpy(dir, ""); + strcpy(link, ctx.repo->name); + token = strtok_r(link, delim, &saveptr); + while (token != NULL) { + if (strcmp(dir, "") != 0) + strcat(dir, delim); + strcat(dir, token); + strcpy(ctx.repo->name, dir); + cgit_summary_link(token, ctx.repo->name, NULL, NULL); + token = strtok_r(NULL, delim, &saveptr); + if (token != NULL) + html(delim); + } + if (ctx.env.authenticated) { html(""); html("
\n"); -- 2.8.1