aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--object.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/object.c b/object.c
index b2319f624..69fbbbf50 100644
--- a/object.c
+++ b/object.c
@@ -163,6 +163,8 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
if (obj->type == type)
return obj;
else if (obj->type == OBJ_NONE) {
+ if (type == OBJ_COMMIT)
+ ((struct commit *)obj)->index = alloc_commit_index();
obj->type = type;
return obj;
}