From cc0722edd0776bacaec72e9b0e7a39983ee45e1e Mon Sep 17 00:00:00 2001 From: patrick-scho Date: Mon, 1 Dec 2025 01:05:31 +0100 Subject: moar changez --- ui-tree.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'ui-tree.c') diff --git a/ui-tree.c b/ui-tree.c index 1e4efb2..2e632ee 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -273,9 +273,11 @@ static void ls_head(void) html("\n"); } -static void ls_tail(void) +static void ls_tail(const char *readme_path) { html("\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); -- cgit v1.2.3