summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-05 14:26:19 -0800
committerJunio C Hamano <gitster@pobox.com>2019-02-05 14:26:19 -0800
commit2ed3de439e2de9646e1501a46bc4fd80c977e611 (patch)
tree4b384ce7129b83b3af93ccd2d4ee8101f1ac93e7 /object.c
parentd6cc13602bdd61d6f12a5fc10b2d342033502afa (diff)
parent4468d4435c44d50723e96e3416f8b5da97a1806f (diff)
downloadgit-2ed3de439e2de9646e1501a46bc4fd80c977e611.tar.gz
Merge branch 'sg/object-as-type-commit-graph-fix'
The commit-graph facility did not work when in-core objects that are promoted from unknown type to commit (e.g. a commit that is accessed via a tag that refers to it) were involved, which has been corrected. * sg/object-as-type-commit-graph-fix: object_as_type: initialize commit-graph-related fields of 'struct commit'
Diffstat (limited to 'object.c')
-rw-r--r--object.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/object.c b/object.c
index 541934ecdd..5dc5eec367 100644
--- 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 {