about summary refs log tree commit diff stats
path: root/ui-summary.c
diff options
context:
space:
mode:
authorJason A. Donenfeld2013-05-25 14:19:10 +0200
committerJason A. Donenfeld2013-05-25 20:33:28 +0200
commit3cb5d86dc68bab4883bf5a7cbc90f3e266237355 (patch)
treef7e3e798447d45179b4169a053f67e0ea3048c14 /ui-summary.c
parentcgit.c: Do not reset HOME after unsetting it. (diff)
downloadcgit-3cb5d86dc68bab4883bf5a7cbc90f3e266237355.tar.gz
cgit-3cb5d86dc68bab4883bf5a7cbc90f3e266237355.zip
ui-summary: Use default branch for readme if : prefix
If the readme value begins with ":", and has no specified branch before
it, use the repository's default branch.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui-summary.c')
-rw-r--r--ui-summary.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ui-summary.c b/ui-summary.c index f965b32..abf914e 100644 --- a/ui-summary.c +++ b/ui-summary.c
@@ -108,7 +108,12 @@ void cgit_print_repo_readme(char *path)
108 colon = strchr(ctx.repo->readme, ':'); 108 colon = strchr(ctx.repo->readme, ':');
109 if (colon && strlen(colon) > 1) { 109 if (colon && strlen(colon) > 1) {
110 *colon = '\0'; 110 *colon = '\0';
111 ref = ctx.repo->readme; 111 /* If it starts with a colon, we want to use
112 * the default branch */
113 if (colon == ctx.repo->readme && ctx.repo->defbranch)
114 ref = ctx.repo->defbranch;
115 else
116 ref = ctx.repo->readme;
112 ctx.repo->readme = colon + 1; 117 ctx.repo->readme = colon + 1;
113 if (!(*ctx.repo->readme)) 118 if (!(*ctx.repo->readme))
114 return; 119 return;