about summary refs log tree commit diff
path: root/ui-summary.c
diff options
context:
space:
mode:
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)
 	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;