about summary refs log tree commit diff stats
path: root/ui-plain.c
diff options
context:
space:
mode:
authorJune McEnroe2022-02-13 12:07:49 -0500
committerJune McEnroe2022-02-13 12:10:49 -0500
commit516175469a8c6895496ef909b487992deb45f460 (patch)
treee0e8b4d38f05e870089de8babc0d3aca3bb4d3b0 /ui-plain.c
parentFix crash trying to print "this commit" on 404s (diff)
parentgit: update to v2.32.0 (diff)
downloadcgit-516175469a8c6895496ef909b487992deb45f460.tar.gz
cgit-516175469a8c6895496ef909b487992deb45f460.zip
Merge up to git v2.32.0
Diffstat (limited to 'ui-plain.c')
-rw-r--r--ui-plain.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ui-plain.c b/ui-plain.c index 2a7b18c..65a205f 100644 --- a/ui-plain.c +++ b/ui-plain.c
@@ -99,7 +99,7 @@ static void print_dir(const struct object_id *oid, const char *base,
99 fullpath = NULL; 99 fullpath = NULL;
100 } 100 }
101 html("<li>"); 101 html("<li>");
102 cgit_plain_link("../", NULL, NULL, ctx.qry.head, ctx.qry.sha1, 102 cgit_plain_link("../", NULL, NULL, ctx.qry.head, ctx.qry.oid,
103 fullpath); 103 fullpath);
104 html("</li>\n"); 104 html("</li>\n");
105 } 105 }
@@ -118,7 +118,7 @@ static void print_dir_entry(const struct object_id *oid, const char *base,
118 if (S_ISGITLINK(mode)) { 118 if (S_ISGITLINK(mode)) {
119 cgit_submodule_link(NULL, fullpath, oid_to_hex(oid)); 119 cgit_submodule_link(NULL, fullpath, oid_to_hex(oid));
120 } else 120 } else
121 cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.sha1, 121 cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.oid,
122 fullpath); 122 fullpath);
123 html("</li>\n"); 123 html("</li>\n");
124 free(fullpath); 124 free(fullpath);
@@ -130,7 +130,7 @@ static void print_dir_tail(void)
130} 130}
131 131
132static int walk_tree(const struct object_id *oid, struct strbuf *base, 132static int walk_tree(const struct object_id *oid, struct strbuf *base,
133 const char *pathname, unsigned mode, int stage, void *cbdata) 133 const char *pathname, unsigned mode, void *cbdata)
134{ 134{
135 struct walk_tree_context *walk_tree_ctx = cbdata; 135 struct walk_tree_context *walk_tree_ctx = cbdata;
136 136
@@ -163,7 +163,7 @@ static int basedir_len(const char *path)
163 163
164void cgit_print_plain(void) 164void cgit_print_plain(void)
165{ 165{
166 const char *rev = ctx.qry.sha1; 166 const char *rev = ctx.qry.oid;
167 struct object_id oid; 167 struct object_id oid;
168 struct commit *commit; 168 struct commit *commit;
169 struct pathspec_item path_items = { 169 struct pathspec_item path_items = {
@@ -198,9 +198,8 @@ void cgit_print_plain(void)
198 } 198 }
199 else 199 else
200 walk_tree_ctx.match_baselen = basedir_len(path_items.match); 200 walk_tree_ctx.match_baselen = basedir_len(path_items.match);
201 read_tree_recursive(the_repository, 201 read_tree(the_repository, repo_get_commit_tree(the_repository, commit),
202 repo_get_commit_tree(the_repository, commit), 202 &paths, walk_tree, &walk_tree_ctx);
203 "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
204 if (!walk_tree_ctx.match) 203 if (!walk_tree_ctx.match)
205 cgit_print_error_page(404, "Not found", "Not found"); 204 cgit_print_error_page(404, "Not found", "Not found");
206 else if (walk_tree_ctx.match == 2) 205 else if (walk_tree_ctx.match == 2)