summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/tree.c b/tree.c
index c8c49d7..bb02c1c 100644
--- a/tree.c
+++ b/tree.c
@@ -183,15 +183,8 @@ struct tree *lookup_tree(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
if (!obj)
- return create_object(sha1, OBJ_TREE, alloc_tree_node());
- if (!obj->type)
- obj->type = OBJ_TREE;
- if (obj->type != OBJ_TREE) {
- error("Object %s is a %s, not a tree",
- sha1_to_hex(sha1), typename(obj->type));
- return NULL;
- }
- return (struct tree *) obj;
+ return create_object(sha1, alloc_tree_node());
+ return object_as_type(obj, OBJ_TREE, 0);
}
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)