-rw-r--r-- | ui-summary.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/ui-summary.c b/ui-summary.c index a2c018e..02f191e 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -3,2 +3,3 @@ * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2010 Jason A. Donenfeld <Jason@zx2c4.com> * @@ -12,2 +13,3 @@ #include "ui-refs.h" +#include "ui-blob.h" @@ -70,3 +72,3 @@ void cgit_print_repo_readme(char *path) { - char *slash, *tmp; + char *slash, *tmp, *colon, *ref = 0; @@ -77,4 +79,7 @@ void cgit_print_repo_readme(char *path) slash = strrchr(ctx.repo->readme, '/'); - if (!slash) - return; + if (!slash) { + slash = strchr(ctx.repo->readme, ':'); + if (!slash) + return; + } tmp = xmalloc(slash - ctx.repo->readme + 1 + strlen(path) + 1); @@ -84,2 +89,12 @@ void cgit_print_repo_readme(char *path) tmp = ctx.repo->readme; + colon = strchr(tmp, ':'); + if (colon && strlen(colon) > 1) { + *colon = '\0'; + ref = tmp; + tmp = colon + 1; + while ((*tmp == '/' || *tmp == ':') && *tmp != '\0') + ++tmp; + if (!(*tmp)) + return; + } html("<div id='summary'>"); @@ -87,3 +102,6 @@ void cgit_print_repo_readme(char *path) cgit_open_filter(ctx.repo->about_filter); - html_include(tmp); + if (ref) + cgit_print_file(tmp, ref); + else + html_include(tmp); if (ctx.repo->about_filter) |