[PATCH v2] ui-shared: split repository link into directories
Petr Vorel
petr.vorel at gmail.com
Thu Apr 28 23:24:52 CEST 2016
Signed-off-by: Petr Vorel <petr.vorel at gmail.com>
---
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.
v2: minor cleanup
---
ui-shared.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/ui-shared.c b/ui-shared.c
index 9a38aa9..a8cf2a8 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -937,7 +937,21 @@ 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, *link, *delim = "/";
+ char dir[strlen(ctx.repo->name)];
+ strcpy(dir, "");
+ link = ctx.repo->name;
+ while ((token = strtok_r(link, delim, &link))) {
+ if (strcmp(dir, "") != 0)
+ strcat(dir, delim);
+ strcat(dir, token);
+ strcpy(ctx.repo->name, dir);
+ cgit_summary_link(token, ctx.repo->name, NULL, NULL);
+ if (strcmp(link, "") != 0)
+ html(delim);
+ }
+
if (ctx.env.authenticated) {
html("</td><td class='form'>");
html("<form method='get' action=''>\n");
--
2.8.1
More information about the CGit
mailing list