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>
Tá an tiomantas seo le fáil i:
Jason A. Donenfeld
2013-05-25 14:19:10 +02:00
tuismitheoir 03eb76dfad
tiomantas 3cb5d86dc6
D'athraigh 2 comhad le 9 breiseanna agus 2 scriosta

Féach ar an gComhad

@ -108,7 +108,12 @@ void cgit_print_repo_readme(char *path)
colon = strchr(ctx.repo->readme, ':');
if (colon && strlen(colon) > 1) {
*colon = '\0';
ref = ctx.repo->readme;
/* If it starts with a colon, we want to use
* the default branch */
if (colon == ctx.repo->readme && ctx.repo->defbranch)
ref = ctx.repo->defbranch;
else
ref = ctx.repo->readme;
ctx.repo->readme = colon + 1;
if (!(*ctx.repo->readme))
return;