]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-summary.c
ui-summary: Use default branch for readme if : prefix
[ps-cgit] / ui-summary.c
index f965b320b4033a01aca83adac5f3b6f91dfeab7a..abf914ea7b9bef132613045e925f6528b75fea2d 100644 (file)
@@ -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;