Felipe Contreras <felipe.contre...@gmail.com> writes:

>> This updates the parse_object() moved by the previous patch. At this
>> point in the codeflow, unlike the original, we already _know_ the
>> object must be a commit; wouldn't an equivalent of:
>>         object = &(lookup_commit(sha1)->object)
>> be more correct here?
> Maybe, if we want to run some extra code we don't care about.
> The only actual difference is that object->type will be OBJ_COMMIT,
> ...

The reason to prefer lookup_commit() over lookup_unknown_object() is
primarily that we allocate the storage for known type, not union,
out of the allocation pool (alloc.c) for the known type.  Also we
mark the result with the type so that we can catch mistakes in data
when later code somehow expects an object with the same object name
to be of different type; while the latter is a good safety measure,
I do not think it matters that much in this codepath. The former is
more important in general.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to