summaryrefslogtreecommitdiffabout
path: root/ui-summary.c
authorJason A. Donenfeld <Jason@zx2c4.com>2010-08-03 22:45:42 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-08-20 16:57:30 (UTC)
commit379e80e3a83481d3639c5d312eeddcce57c486b2 (patch) (side-by-side diff)
tree474ac38e3812008532d4ebd0b095ac835b5478b5 /ui-summary.c
parentaec9c245e7eaf444c7ae1851e3eda3b30748950f (diff)
downloadcgit-379e80e3a83481d3639c5d312eeddcce57c486b2.zip
cgit-379e80e3a83481d3639c5d312eeddcce57c486b2.tar.gz
cgit-379e80e3a83481d3639c5d312eeddcce57c486b2.tar.bz2
Support refspecs in about-filter.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-summary.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-summary.c20
1 files changed, 19 insertions, 1 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) {
+ 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,2 +102,5 @@ void cgit_print_repo_readme(char *path)
cgit_open_filter(ctx.repo->about_filter);
+ if (ref)
+ cgit_print_file(tmp, ref);
+ else
html_include(tmp);