diff options
| author | patrick-scho | 2025-12-01 01:05:31 +0100 |
|---|---|---|
| committer | patrick-scho | 2025-12-01 01:05:31 +0100 |
| commit | cc0722edd0776bacaec72e9b0e7a39983ee45e1e (patch) | |
| tree | 10c5b7ff428b85498a8002b17f71678da41faa18 /ui-tree.c | |
| parent | e8a031e1a565111169213d7fc13db4dd14fd926e (diff) | |
| download | ps-cgit-cc0722edd0776bacaec72e9b0e7a39983ee45e1e.tar.gz ps-cgit-cc0722edd0776bacaec72e9b0e7a39983ee45e1e.zip | |
moar changez
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); |
