abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorpatrick-scho2025-12-01 15:27:49 +0100
committerpatrick-scho2025-12-01 15:27:49 +0100
commit38a12c2ddde5188bbbd04501883b7092745b0dac (patch)
tree847a2df730cbacd027cedf492c424062cfdf02ed
parent4bf7dacfa870fb1fb81edf647fd5c049786c3c2f (diff)
downloadps-cgit-38a12c2ddde5188bbbd04501883b7092745b0dac.tar.gz
ps-cgit-38a12c2ddde5188bbbd04501883b7092745b0dac.zip
changes
-rw-r--r--ui-blob.c1
-rw-r--r--ui-summary.c7
-rw-r--r--ui-summary.h2
-rw-r--r--ui-tree.c13
4 files changed, 12 insertions, 11 deletions
diff --git a/ui-blob.c b/ui-blob.c
index 3267ed1..cc88d76 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -72,6 +72,7 @@ int cgit_print_oid(const struct object_id *oid)
unsigned long size;
type = oid_object_info(the_repository, oid, &size);
+ html_txtf("trying to print %x<br/>", oid);
if (type == OBJ_BAD)
return -1;
buf = read_object_file(oid, &type, &size);
diff --git a/ui-summary.c b/ui-summary.c
index 76f7df6..b3e5cc6 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -173,8 +173,7 @@ static int get_readme_oid_cb(const struct object_id *oid, struct strbuf *base,
return 0;
}
-const struct object_id * get_readme_oid(const struct object_id *oid, char **filename) {
- struct tree *tree = parse_tree_indirect(oid);
+const struct object_id * get_readme_oid(const struct tree *tree, char **filename) {
struct pathspec paths = {
.nr = 0
};
@@ -184,10 +183,10 @@ const struct object_id * get_readme_oid(const struct object_id *oid, char **file
return ctx.oid;
}
-void cgit_print_repo_readme_no_layout(const struct object_id *oid)
+void cgit_print_repo_readme_no_layout(const struct tree *tree)
{
char *filename = NULL;
- const struct object_id *readme_oid = get_readme_oid(oid, &filename);
+ const struct object_id *readme_oid = get_readme_oid(tree, &filename);
if (readme_oid) {
html("<div id='summary'>");
cgit_open_filter(ctx.repo->about_filter, filename);
diff --git a/ui-summary.h b/ui-summary.h
index a067010..03ee5e4 100644
--- a/ui-summary.h
+++ b/ui-summary.h
@@ -3,6 +3,6 @@
extern void cgit_print_summary(void);
extern void cgit_print_repo_readme(const char *path);
-extern void cgit_print_repo_readme_no_layout(const struct object_id *oid);
+extern void cgit_print_repo_readme_no_layout(const struct tree *tree);
#endif /* UI_SUMMARY_H */
diff --git a/ui-tree.c b/ui-tree.c
index 9cbed30..5e78f64 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -274,11 +274,11 @@ static void ls_head(void)
html("</tr>\n");
}
-static void ls_tail(const struct object_id *oid)
+static void ls_tail(const struct tree *tree)
{
html("</table>\n");
- if (oid)
- cgit_print_repo_readme_no_layout(oid);
+ if (tree)
+ cgit_print_repo_readme_no_layout(tree);
cgit_print_layout_end();
}
@@ -299,7 +299,7 @@ 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(oid);
+ ls_tail(tree);
}
@@ -377,12 +377,13 @@ void cgit_print_tree(const char *rev, char *path)
goto cleanup;
}
+ const struct tree *tree = repo_get_commit_tree(the_repository, commit);
read_tree_recursive(the_repository,
- repo_get_commit_tree(the_repository, commit),
+ tree,
"", 0, 0,
&paths, walk_tree, &walk_tree_ctx);
if (walk_tree_ctx.state == 1) {
- ls_tail(NULL);
+ ls_tail(tree);
}
else if (walk_tree_ctx.state == 2) {
cgit_print_layout_end();