summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'object.c')
-rw-r--r--object.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/object.c b/object.c
index 1418845..4e85955 100644
--- a/object.c
+++ b/object.c
@@ -185,6 +185,24 @@ struct object *lookup_unknown_object(struct repository *r, const struct object_i
return obj;
}
+struct object *lookup_object_by_type(struct repository *r,
+ const struct object_id *oid,
+ enum object_type type)
+{
+ switch (type) {
+ case OBJ_COMMIT:
+ return (struct object *)lookup_commit(r, oid);
+ case OBJ_TREE:
+ return (struct object *)lookup_tree(r, oid);
+ case OBJ_TAG:
+ return (struct object *)lookup_tag(r, oid);
+ case OBJ_BLOB:
+ return (struct object *)lookup_blob(r, oid);
+ default:
+ die("BUG: unknown object type %d", type);
+ }
+}
+
struct object *parse_object_buffer(struct repository *r, const struct object_id *oid, enum object_type type, unsigned long size, void *buffer, int *eaten_p)
{
struct object *obj;
@@ -511,6 +529,8 @@ static void free_object_directories(struct raw_object_store *o)
free_object_directory(o->odb);
o->odb = next;
}
+ kh_destroy_odb_path_map(o->odb_by_path);
+ o->odb_by_path = NULL;
}
void raw_object_store_clear(struct raw_object_store *o)