aboutsummaryrefslogtreecommitdiffstats
path: root/ui-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 3d8a2eb..9331285 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -93,15 +93,15 @@ static void print_object(const struct object_id *oid, const char *path, const ch
unsigned long size;
bool is_binary;
- type = oid_object_info(the_repository, oid, &size);
- if (type == OBJ_BAD) {
+ if (!odb_has_object(the_repository->objects, oid, 0)) {
cgit_print_error_page(404, "Not found",
- "Bad object name: %s", oid_to_hex(oid));
+ "Object %s not found in repository",
+ oid_to_hex(oid));
return;
}
- buf = repo_read_object_file(the_repository, oid, &type, &size);
- if (!buf) {
+ buf = odb_read_object(the_repository->objects, oid, &type, &size);
+ if (!buf || type != OBJ_BLOB) {
cgit_print_error_page(500, "Internal server error",
"Error reading object %s", oid_to_hex(oid));
return;
@@ -217,8 +217,14 @@ static int ls_item(const struct object_id *oid, struct strbuf *base,
ctx.qry.path ? "/" : "", name);
if (!S_ISGITLINK(mode)) {
- type = oid_object_info(the_repository, oid, &size);
- if (type == OBJ_BAD) {
+
+ struct object_info oi = {
+ .typep = &type,
+ .sizep = &size
+ };
+
+ if (odb_read_object_info_extended(the_repository->objects, oid,
+ &oi, OBJECT_INFO_LOOKUP_REPLACE) < 0 || type == OBJ_BAD) {
htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>",
name,
oid_to_hex(oid));
@@ -244,7 +250,7 @@ static int ls_item(const struct object_id *oid, struct strbuf *base,
}
if (S_ISLNK(mode)) {
html(" -> ");
- buf = repo_read_object_file(the_repository, oid, &type, &size);
+ buf = odb_read_object(the_repository->objects, oid, &type, &size);
if (!buf) {
htmlf("Error reading object: %s", oid_to_hex(oid));
goto cleanup;