git/odb
Patrick Steinhardt 27bed41ebb odb/source-packed: improve lookup when enumerating objects
When iterating through objects of a packed source that have a specific
prefix we do so via two different methods:

  - When a multi-pack index is available we use that one to efficiently
    loop through all objects.

  - We then loop through all packfiles that aren't covered by a
    multi-pack index.

Regardless of which mechanism we use, we then iterate through all the
objects indexed by the respective data structure. Curiously though,
while we use the indices for enumerating the objects, we completely
ignore it for the actual object lookup. Instead, we call into the
generic `odb_source_read_object_info()` function, which will itself
consult the indices to figure out where the object in question even
lives.

This has two consequences:

  - It's inefficient, as we basically have to figure out the position of
    the object a second time.

  - It's subtly wrong, as it may now happen that a specific object will
    be looked up via a different pack in case it exists multiple times.
    This is unlikely to have any real-world consequences, but it's still
    the wrong thing to do.

Fix the issue by using `packed_object_info()` directly. While at it,
rename the `store` variable to `source`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-15 07:19:15 -07:00
..
source-files.c Merge branch 'po/hash-object-size-t' 2026-07-06 15:50:22 -07:00
source-files.h packfile: rename `struct packfile_store` to `odb_source_packed` 2026-06-17 04:59:59 -07:00
source-inmemory.c Merge branch 'ps/odb-drop-whence' into ps/odb-for-each-object-filter 2026-07-09 10:12:15 -07:00
source-inmemory.h odb/source-inmemory: convert to use oidtree 2026-05-15 04:50:45 +09:00
source-loose.c Merge branch 'ps/odb-drop-whence' into ps/odb-for-each-object-filter 2026-07-09 10:12:15 -07:00
source-loose.h odb/source-loose: drop pointer to the "files" source 2026-06-01 18:47:19 +09:00
source-packed.c odb/source-packed: improve lookup when enumerating objects 2026-07-15 07:19:15 -07:00
source-packed.h Merge branch 'ps/odb-source-packed' 2026-07-06 15:50:21 -07:00
source.c odb/source: make `free()` function pluggable 2026-03-05 11:45:15 -08:00
source.h Merge branch 'po/hash-object-size-t' 2026-07-06 15:50:22 -07:00
streaming.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
streaming.h Merge branch 'ps/odb-in-memory' into ps/odb-source-loose 2026-05-21 22:34:55 +09:00
transaction.c odb/transaction: make `write_object_stream()` pluggable 2026-05-15 04:44:40 +09:00
transaction.h odb/transaction: make `write_object_stream()` pluggable 2026-05-15 04:44:40 +09:00