• J
    object_as_type: set commit index · d66bebcb
    Jeff King 提交于
    The point of the "index" field of struct commit is that
    every allocated commit would have one. It is supposed to be
    an invariant that whenever object->type is set to
    OBJ_COMMIT, we have a unique index.
    
    Commit 969eba63 (commit: push commit_index update into
    alloc_commit_node, 2014-06-10) covered this case for
    newly-allocated commits. However, we may also allocate an
    "unknown" object via lookup_unknown_object, and only later
    convert it to a commit. We must make sure that we set the
    commit index when we switch the type field.
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    d66bebcb
object.c 9.9 KB