]> git.ipfire.org Git - thirdparty/git.git/commit
streaming: propagate final object type via the stream
authorPatrick Steinhardt <ps@pks.im>
Sun, 23 Nov 2025 18:59:28 +0000 (19:59 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 23 Nov 2025 20:56:44 +0000 (12:56 -0800)
commit3f64deabdf0a2a9664acec61698affc449e07496
treef76bd3a7bb827117db6be19476ad96a422fcef11
parent70c8b5f5453b9f128a72fad4398acfb9e7d869c4
streaming: propagate final object type via the stream

When opening the read stream for a specific object the caller is also
expected to pass in a pointer to the object type. This type is passed
down via multiple levels and will eventually be populated with the type
of the looked-up object.

The way we propagate down the pointer though is somewhat non-obvious.
While `istream_source()` still expects the pointer and looks it up via
`odb_read_object_info_extended()`, we also pass it down even further
into the format-specific callbacks that perform another lookup. This is
quite confusing overall.

Refactor the code so that the responsibility to populate the object type
rests solely with the format-specific callbacks. This will allow us to
drop the call to `odb_read_object_info_extended()` in `istream_source()`
entirely in a subsequent patch.

Furthermore, instead of propagating the type via an in-pointer, we now
propagate the type via a new field in the object stream. It already has
a `size` field, so it's only natural to have a second field that
contains the object type.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
streaming.c