struct single_tree_ctx {
struct strbuf *path;
- unsigned char sha1[GIT_SHA1_RAWSZ];
+ struct object_id oid;
char *name;
size_t count;
};
}
ctx->name = xstrdup(pathname);
- hashcpy(ctx->sha1, sha1);
+ hashcpy(ctx->oid.hash, sha1);
strbuf_addf(ctx->path, "/%s", pathname);
return 0;
}
.nr = 0
};
- hashcpy(tree_ctx.sha1, sha1);
+ hashcpy(tree_ctx.oid.hash, sha1);
while (tree_ctx.count == 1) {
cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,
fullpath->buf);
- tree = lookup_tree(tree_ctx.sha1);
+ tree = lookup_tree(&tree_ctx.oid);
if (!tree)
return;
cgit_print_layout_end();
}
-static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_context *walk_tree_ctx)
+static void ls_tree(const struct object_id *oid, char *path, struct walk_tree_context *walk_tree_ctx)
{
struct tree *tree;
struct pathspec paths = {
.nr = 0
};
- tree = parse_tree_indirect(sha1);
+ tree = parse_tree_indirect(oid);
if (!tree) {
cgit_print_error_page(404, "Not found",
- "Not a tree object: %s", sha1_to_hex(sha1));
+ "Not a tree object: %s", sha1_to_hex(oid->hash));
return;
}
"Invalid revision name: %s", rev);
return;
}
- commit = lookup_commit_reference(oid.hash);
+ commit = lookup_commit_reference(&oid);
if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found",
"Invalid commit reference: %s", rev);
walk_tree_ctx.curr_rev = xstrdup(rev);
if (path == NULL) {
- ls_tree(commit->tree->object.oid.hash, NULL, &walk_tree_ctx);
+ ls_tree(&commit->tree->object.oid, NULL, &walk_tree_ctx);
goto cleanup;
}