diff options
Diffstat (limited to 'ui-tree.c')
| -rw-r--r-- | ui-tree.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -273,9 +273,11 @@ static void ls_head(void) html("</tr>\n"); } -static void ls_tail(void) +static void ls_tail(const char *readme_path) { html("</table>\n"); + if (readme_path) + cgit_print_repo_readme_no_layout(readme_path); cgit_print_layout_end(); } @@ -296,7 +298,8 @@ static void ls_tree(const struct object_id *oid, const char *path, struct walk_t ls_head(); read_tree_recursive(the_repository, tree, "", 0, 1, &paths, ls_item, walk_tree_ctx); - ls_tail(); + const char *readme_path = "readme.md"; + ls_tail(readme_path); } @@ -378,12 +381,18 @@ void cgit_print_tree(const char *rev, char *path) repo_get_commit_tree(the_repository, commit), "", 0, 0, &paths, walk_tree, &walk_tree_ctx); - if (walk_tree_ctx.state == 1) - ls_tail(); - else if (walk_tree_ctx.state == 2) + const char *readme_path = "readme.md"; // TODO: add more readme options + if (walk_tree_ctx.state == 1) { + ls_tail(readme_path); + } + else if (walk_tree_ctx.state == 2) { + if (readme_path) + cgit_print_repo_readme_no_layout(readme_path); cgit_print_layout_end(); - else + } + else { cgit_print_error_page(404, "Not found", "Path not found"); + } cleanup: free(walk_tree_ctx.curr_rev); |
