M cmd.c => cmd.c +8 -4
@@ 49,11 49,15 @@ static void about_fn(void)
cgit_redirect(redirect, true);
free(currenturl);
free(redirect);
- } else if (ctx.repo->readme.nr)
+ } else if (ctx.repo->readme.nr) {
+ if (ctx.qry.path)
+ ctx.page.title = fmtalloc("%s - %s", ctx.qry.path, ctx.page.title);
+ cgit_print_layout_start();
cgit_print_repo_readme(ctx.qry.path);
- else if (ctx.repo->homepage)
+ cgit_print_layout_end();
+ } else if (ctx.repo->homepage) {
cgit_redirect(ctx.repo->homepage, false);
- else {
+ } else {
char *currenturl = cgit_currenturl();
char *redirect = fmtalloc("%s../", currenturl);
cgit_redirect(redirect, false);
@@ 196,7 200,7 @@ struct cgit_cmd *cgit_get_cmd(void)
if (ctx.qry.page == NULL) {
if (ctx.repo)
- ctx.qry.page = "summary";
+ ctx.qry.page = "tree";
else
ctx.qry.page = "repolist";
}
M ui-shared.c => ui-shared.c +2 -17
@@ 1092,16 1092,9 @@ void cgit_print_pageheader(void)
html("<nav>\n");
html("<ul>");
- if (ctx.repo->readme.nr) {
- html("<li>");
- reporevlink("about", "about", NULL,
- hc("about"), ctx.qry.head, NULL,
- NULL);
- html("</li>");
- }
html("<li>");
- cgit_summary_link("summary", NULL, hc("summary"),
- ctx.qry.head);
+ cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head,
+ ctx.qry.oid, ctx.qry.vpath);
html("</li>");
html("<li>");
cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head,
@@ 1113,14 1106,6 @@ void cgit_print_pageheader(void)
ctx.qry.showmsg, ctx.qry.follow);
html("</li>");
html("<li>");
- if (ctx.qry.page && !strcmp(ctx.qry.page, "blame"))
- cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head,
- ctx.qry.oid, ctx.qry.vpath);
- else
- cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head,
- ctx.qry.oid, ctx.qry.vpath);
- html("</li>");
- html("<li>");
cgit_commit_link("commit", NULL, hc("commit"),
ctx.qry.head, ctx.qry.oid, ctx.qry.vpath);
html("</li>");
M ui-summary.c => ui-summary.c +6 -14
@@ 101,7 101,7 @@ static char* append_readme_path(const char *filename, const char *ref, const cha
void cgit_print_repo_readme(const char *path)
{
- char *filename, *ref, *mimetype;
+ char *filename, *ref, *mimetype, *fullname;
int free_filename = 0;
mimetype = get_mimetype_for_filename(path);
@@ 114,22 114,17 @@ void cgit_print_repo_readme(const char *path)
}
free(mimetype);
- if (path)
- ctx.page.title = fmtalloc("%s - %s", path, ctx.page.title);
-
- cgit_print_layout_start();
if (ctx.repo->readme.nr == 0)
- goto done;
+ return;
filename = ctx.repo->readme.items[0].string;
ref = ctx.repo->readme.items[0].util;
if (path) {
- free_filename = 1;
- filename = append_readme_path(filename, ref, path);
- if (!filename)
- goto done;
- }
+ free_filename = 1;
+ filename = fmtalloc("%s/%s", path, filename);
+ }
+
/* Print the calculated readme, either from the git repo or from the
* filesystem, while applying the about-filter.
@@ 145,7 140,4 @@ void cgit_print_repo_readme(const char *path)
html("</div>");
if (free_filename)
free(filename);
-
-done:
- cgit_print_layout_end();
}
M ui-tree.c => ui-tree.c +1 -0
@@ 277,6 277,7 @@ static void ls_head(void)
static void ls_tail(void)
{
html("</table>\n");
+ cgit_print_repo_readme(ctx.qry.path);
cgit_print_layout_end();
}