diff options
author | June McEnroe | 2022-02-13 12:07:49 -0500 |
---|---|---|
committer | June McEnroe | 2022-02-13 12:10:49 -0500 |
commit | 516175469a8c6895496ef909b487992deb45f460 (patch) | |
tree | e0e8b4d38f05e870089de8babc0d3aca3bb4d3b0 /ui-tree.c | |
parent | Fix crash trying to print "this commit" on 404s (diff) | |
parent | git: update to v2.32.0 (diff) | |
download | cgit-516175469a8c6895496ef909b487992deb45f460.tar.gz cgit-516175469a8c6895496ef909b487992deb45f460.zip |
Merge up to git v2.32.0
Diffstat (limited to 'ui-tree.c')
-rw-r--r-- | ui-tree.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/ui-tree.c b/ui-tree.c index 34e7e63..21e0b88 100644 --- a/ui-tree.c +++ b/ui-tree.c | |||
@@ -141,8 +141,7 @@ struct single_tree_ctx { | |||
141 | }; | 141 | }; |
142 | 142 | ||
143 | static int single_tree_cb(const struct object_id *oid, struct strbuf *base, | 143 | static int single_tree_cb(const struct object_id *oid, struct strbuf *base, |
144 | const char *pathname, unsigned mode, int stage, | 144 | const char *pathname, unsigned mode, void *cbdata) |
145 | void *cbdata) | ||
146 | { | 145 | { |
147 | struct single_tree_ctx *ctx = cbdata; | 146 | struct single_tree_ctx *ctx = cbdata; |
148 | 147 | ||
@@ -187,8 +186,7 @@ static void write_tree_link(const struct object_id *oid, char *name, | |||
187 | tree_ctx.name = NULL; | 186 | tree_ctx.name = NULL; |
188 | tree_ctx.count = 0; | 187 | tree_ctx.count = 0; |
189 | 188 | ||
190 | read_tree_recursive(the_repository, tree, "", 0, 1, | 189 | read_tree(the_repository, tree, &paths, single_tree_cb, &tree_ctx); |
191 | &paths, single_tree_cb, &tree_ctx); | ||
192 | 190 | ||
193 | if (tree_ctx.count != 1) | 191 | if (tree_ctx.count != 1) |
194 | break; | 192 | break; |
@@ -201,7 +199,7 @@ static void write_tree_link(const struct object_id *oid, char *name, | |||
201 | } | 199 | } |
202 | 200 | ||
203 | static int ls_item(const struct object_id *oid, struct strbuf *base, | 201 | static int ls_item(const struct object_id *oid, struct strbuf *base, |
204 | const char *pathname, unsigned mode, int stage, void *cbdata) | 202 | const char *pathname, unsigned mode, void *cbdata) |
205 | { | 203 | { |
206 | struct walk_tree_context *walk_tree_ctx = cbdata; | 204 | struct walk_tree_context *walk_tree_ctx = cbdata; |
207 | char *name; | 205 | char *name; |
@@ -320,14 +318,13 @@ static void ls_tree(const struct object_id *oid, const char *path, struct walk_t | |||
320 | } | 318 | } |
321 | 319 | ||
322 | ls_head(); | 320 | ls_head(); |
323 | read_tree_recursive(the_repository, tree, "", 0, 1, | 321 | read_tree(the_repository, tree, &paths, ls_item, walk_tree_ctx); |
324 | &paths, ls_item, walk_tree_ctx); | ||
325 | ls_tail(); | 322 | ls_tail(); |
326 | } | 323 | } |
327 | 324 | ||
328 | 325 | ||
329 | static int walk_tree(const struct object_id *oid, struct strbuf *base, | 326 | static int walk_tree(const struct object_id *oid, struct strbuf *base, |
330 | const char *pathname, unsigned mode, int stage, void *cbdata) | 327 | const char *pathname, unsigned mode, void *cbdata) |
331 | { | 328 | { |
332 | struct walk_tree_context *walk_tree_ctx = cbdata; | 329 | struct walk_tree_context *walk_tree_ctx = cbdata; |
333 | 330 | ||
@@ -352,7 +349,7 @@ static int walk_tree(const struct object_id *oid, struct strbuf *base, | |||
352 | return 0; | 349 | return 0; |
353 | } | 350 | } |
354 | } | 351 | } |
355 | ls_item(oid, base, pathname, mode, stage, walk_tree_ctx); | 352 | ls_item(oid, base, pathname, mode, walk_tree_ctx); |
356 | return 0; | 353 | return 0; |
357 | } | 354 | } |
358 | 355 | ||
@@ -400,10 +397,8 @@ void cgit_print_tree(const char *rev, char *path) | |||
400 | goto cleanup; | 397 | goto cleanup; |
401 | } | 398 | } |
402 | 399 | ||
403 | read_tree_recursive(the_repository, | 400 | read_tree(the_repository, repo_get_commit_tree(the_repository, commit), |
404 | repo_get_commit_tree(the_repository, commit), | 401 | &paths, walk_tree, &walk_tree_ctx); |
405 | "", 0, 0, | ||
406 | &paths, walk_tree, &walk_tree_ctx); | ||
407 | if (walk_tree_ctx.state == 1) | 402 | if (walk_tree_ctx.state == 1) |
408 | ls_tail(); | 403 | ls_tail(); |
409 | else if (walk_tree_ctx.state == 2) | 404 | else if (walk_tree_ctx.state == 2) |