Website Summary Files Commits Branches @commit @diff @stats
path: root / ui-tree.c
diff options
context:
space:
mode:
Commit63aa2ecd4e72800c11b08e4fb94234a117ece029 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-09-27 22:04:58 +0300
Committer
 Syndamia <kamen@syndamia.com>
2026-09-27 22:17:41 +0300
Filesf399e7b86e2c450adc2a62b517af100db65c1b73 /ui-tree.c
cgit-63aa2ecd4e72800c11b08e4fb94234a117ece029.tar
cgit-63aa2ecd4e72800c11b08e4fb94234a117ece029.tar.gz
cgit-63aa2ecd4e72800c11b08e4fb94234a117ece029.zip
Parent59125deae6522ca335a16c84a67e57e85edb88d6 (diff)
ui-summary: (THEME) Rework what is shown in summary page
Now clone and branches are shown next to commits and tags, branches only show name and age, clone does not create links, and file listing (alongside readme) is shown below
1 files changed, 41 insertions, 0 deletions
-rw-r--r--ui-tree.c41
diff --git a/ui-tree.c b/ui-tree.c
index 27cbd46..9616e33 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -431,3 +431,44 @@ void cgit_print_tree(const char *rev, char *path)
cleanup:
free(walk_tree_ctx.curr_rev);
}
+
+void cgit_print_tree_component(const char *rev, char *path)
+{
+ struct object_id oid;
+ struct commit *commit;
+ struct walk_tree_context walk_tree_ctx = {
+ .match_path = path,
+ .state = 0
+ };
+ struct tree *tree;
+ struct pathspec paths = {
+ .nr = 0
+ };
+
+ if (!rev)
+ rev = ctx.qry.head;
+
+ if (path != NULL || repo_get_oid(the_repository, rev, &oid))
+ return;
+
+ commit = lookup_commit_reference(the_repository, &oid);
+ if (!commit || repo_parse_commit(the_repository, commit))
+ return;
+
+ walk_tree_ctx.curr_rev = xstrdup(rev);
+
+ tree = parse_tree_indirect(get_commit_tree_oid(commit));
+ if (tree) {
+ html("<table summary='tree listing' class='list'>\n");
+ html("<tr class='nohover'>");
+ html("<th class='left'>Name</th>");
+ html("<th class='right'>Size</th>");
+ html("<th/>");
+ html("</tr>\n");
+ read_tree(the_repository, tree, &paths, ls_item, &walk_tree_ctx);
+ html("</table>\n");
+ cgit_print_repo_readme_component(ctx.qry.path);
+ }
+
+ free(walk_tree_ctx.curr_rev);
+}