Merge branch 'pw/rebase-x-sanity-check'
[gitweb.git] / object.c
index 541934ecdd214535eed584598d4354d89fd6c6b0..5dc5eec367354ae4817b813b181423e096179a8a 100644 (file)
--- a/object.c
+++ b/object.c
@@ -164,8 +164,9 @@ void *object_as_type(struct repository *r, struct object *obj, enum object_type
                return obj;
        else if (obj->type == OBJ_NONE) {
                if (type == OBJ_COMMIT)
-                       ((struct commit *)obj)->index = alloc_commit_index(r);
-               obj->type = type;
+                       init_commit_node(r, (struct commit *) obj);
+               else
+                       obj->type = type;
                return obj;
        }
        else {