author | Jason 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) |
commit | 379e80e3a83481d3639c5d312eeddcce57c486b2 (patch) (unidiff) | |
tree | 474ac38e3812008532d4ebd0b095ac835b5478b5 /ui-summary.c | |
parent | aec9c245e7eaf444c7ae1851e3eda3b30748950f (diff) | |
download | cgit-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>
-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 | |||
@@ -2,4 +2,5 @@ | |||
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * Copyright (C) 2010 Jason A. Donenfeld <Jason@zx2c4.com> | ||
4 | * | 5 | * |
5 | * Licensed under GNU General Public License v2 | 6 | * Licensed under GNU General Public License v2 |
@@ -11,4 +12,5 @@ | |||
11 | #include "ui-log.h" | 12 | #include "ui-log.h" |
12 | #include "ui-refs.h" | 13 | #include "ui-refs.h" |
14 | #include "ui-blob.h" | ||
13 | 15 | ||
14 | int urls = 0; | 16 | int urls = 0; |
@@ -69,5 +71,5 @@ void cgit_print_summary() | |||
69 | void cgit_print_repo_readme(char *path) | 71 | void cgit_print_repo_readme(char *path) |
70 | { | 72 | { |
71 | char *slash, *tmp; | 73 | char *slash, *tmp, *colon, *ref = 0; |
72 | 74 | ||
73 | if (!ctx.repo->readme) | 75 | if (!ctx.repo->readme) |
@@ -76,6 +78,9 @@ void cgit_print_repo_readme(char *path) | |||
76 | if (path) { | 78 | if (path) { |
77 | slash = strrchr(ctx.repo->readme, '/'); | 79 | slash = strrchr(ctx.repo->readme, '/'); |
78 | if (!slash) | 80 | if (!slash) { |
79 | return; | 81 | slash = strchr(ctx.repo->readme, ':'); |
82 | if (!slash) | ||
83 | return; | ||
84 | } | ||
80 | tmp = xmalloc(slash - ctx.repo->readme + 1 + strlen(path) + 1); | 85 | tmp = xmalloc(slash - ctx.repo->readme + 1 + strlen(path) + 1); |
81 | strncpy(tmp, ctx.repo->readme, slash - ctx.repo->readme + 1); | 86 | strncpy(tmp, ctx.repo->readme, slash - ctx.repo->readme + 1); |
@@ -83,8 +88,21 @@ void cgit_print_repo_readme(char *path) | |||
83 | } else | 88 | } else |
84 | tmp = ctx.repo->readme; | 89 | tmp = ctx.repo->readme; |
90 | colon = strchr(tmp, ':'); | ||
91 | if (colon && strlen(colon) > 1) { | ||
92 | *colon = '\0'; | ||
93 | ref = tmp; | ||
94 | tmp = colon + 1; | ||
95 | while ((*tmp == '/' || *tmp == ':') && *tmp != '\0') | ||
96 | ++tmp; | ||
97 | if (!(*tmp)) | ||
98 | return; | ||
99 | } | ||
85 | html("<div id='summary'>"); | 100 | html("<div id='summary'>"); |
86 | if (ctx.repo->about_filter) | 101 | if (ctx.repo->about_filter) |
87 | cgit_open_filter(ctx.repo->about_filter); | 102 | cgit_open_filter(ctx.repo->about_filter); |
88 | html_include(tmp); | 103 | if (ref) |
104 | cgit_print_file(tmp, ref); | ||
105 | else | ||
106 | html_include(tmp); | ||
89 | if (ctx.repo->about_filter) | 107 | if (ctx.repo->about_filter) |
90 | cgit_close_filter(ctx.repo->about_filter); | 108 | cgit_close_filter(ctx.repo->about_filter); |