From f2382990742bff816ec54883e6204ededc378e7f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 6 Aug 2026 21:09:57 -1000 Subject: Settle the names, types and layout of the sources --- source/ui-tree.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/ui-tree.c') diff --git a/source/ui-tree.c b/source/ui-tree.c index 870ace2..b5a5556 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -161,19 +161,21 @@ struct single_tree_ctx { static int single_tree_cb(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, void *cbdata) { - struct single_tree_ctx *ctx = cbdata; + // Not named ctx: that is the global request context, and shadowing it + // here would hide it from anything added to this function later. + struct single_tree_ctx *tree_ctx = cbdata; - if (++ctx->count > 1) + if (++tree_ctx->count > 1) return -1; if (!S_ISDIR(mode)) { - ctx->count = 2; + tree_ctx->count = 2; return -1; } - ctx->name = xstrdup(pathname); - oidcpy(&ctx->oid, oid); - strbuf_addf(ctx->path, "/%s", pathname); + tree_ctx->name = xstrdup(pathname); + oidcpy(&tree_ctx->oid, oid); + strbuf_addf(tree_ctx->path, "/%s", pathname); return 0; } -- cgit v2.8.0