rebase: support --no-autostash
[gitweb.git] / tree.c
diff --git a/tree.c b/tree.c
index ed6657507937b26c702ff322b99182c688487d50..bb02c1caa4ff6a8af40b89498de3af3381272999 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -184,14 +184,7 @@ struct tree *lookup_tree(const unsigned char *sha1)
        struct object *obj = lookup_object(sha1);
        if (!obj)
                return create_object(sha1, 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 object_as_type(obj, OBJ_TREE, 0);
 }
 
 int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)