<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/packfile.c, branch v2.51.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.51.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.51.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-07-15T19:07:30Z</updated>
<entry>
<title>midx: remove now-unused linked list of multi-pack indices</title>
<updated>2025-07-15T19:07:30Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-15T11:29:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec865d94d4615c00fbf9ac50f4274b1d3fbf73a6'/>
<id>urn:sha1:ec865d94d4615c00fbf9ac50f4274b1d3fbf73a6</id>
<content type='text'>
In the preceding commits we have migrated all users of the linked list
of multi-pack indices to instead use those stored in the object database
sources. Remove those now-unused pointers.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packfile: stop using linked MIDX list in `get_all_packs()`</title>
<updated>2025-07-15T19:07:30Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-15T11:29:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c620586fccf5a62e36a2d6cc96d0427f93f123fc'/>
<id>urn:sha1:c620586fccf5a62e36a2d6cc96d0427f93f123fc</id>
<content type='text'>
Refactor `get_all_packs()` so that we stop using the linked list of
multi-pack indices. Note that there is no need to explicitly prepare
alternates, and neither do we have to use `get_multi_pack_index()`,
because `prepare_packed_git()` already takes care of populating all data
structures for us.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packfile: stop using linked MIDX list in `find_pack_entry()`</title>
<updated>2025-07-15T19:07:29Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-15T11:29:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7fc19983926af6aea1eb393a5deb7bb2fc3cd495'/>
<id>urn:sha1:7fc19983926af6aea1eb393a5deb7bb2fc3cd495</id>
<content type='text'>
Refactor `find_pack_entry()` so that we stop using the linked list of
multi-pack indices. Note that there is no need to explicitly prepare
alternates, and neither do we have to use `get_multi_pack_index()`,
because `prepare_packed_git()` already takes care of populating all data
structures for us.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packfile: refactor `get_multi_pack_index()` to work on sources</title>
<updated>2025-07-15T19:07:29Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-15T11:29:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=736bb725ebcd37d567455db2ac50524dea11223c'/>
<id>urn:sha1:736bb725ebcd37d567455db2ac50524dea11223c</id>
<content type='text'>
The function `get_multi_pack_index()` loads multi-pack indices via
`prepare_packed_git()` and then returns the linked list of multi-pack
indices that is stored in `struct object_database`. That list is in the
process of being removed though in favor of storing the MIDX as part of
the object database source it belongs to.

Refactor `get_multi_pack_index()` so that it returns the multi-pack
index for a single object source. Callers are now expected to call this
function for each source they are interested in. This requires them to
iterate through alternates, so we have to prepare alternate object
sources before doing so.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>midx: stop using linked list when closing MIDX</title>
<updated>2025-07-15T19:07:29Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-15T11:29:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6567432ab4f93f63cd2111197c91651a9b04c517'/>
<id>urn:sha1:6567432ab4f93f63cd2111197c91651a9b04c517</id>
<content type='text'>
When calling `close_midx()` we not only close the multi-pack index for
one object source, but instead we iterate through the whole linked list
of MIDXs to close all of them. This linked list is about to go away in
favor of using the new per-source pointer to its respective MIDX.

Refactor the function to iterate through sources instead.

Note that after this patch, there's a couple of callsites left that
continue to use `close_midx()` without iterating through all sources.
These are all cases where we don't care about the MIDX from other
sources though, so it's fine to keep them as-is.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packfile: refactor `prepare_packed_git_one()` to work on sources</title>
<updated>2025-07-15T19:07:28Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-15T11:29:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec4380f446b76e931002481f3e4be520c77058b6'/>
<id>urn:sha1:ec4380f446b76e931002481f3e4be520c77058b6</id>
<content type='text'>
In the preceding commit we refactored how we load multi-pack indices to
take a corresponding "source" as input. As part of this refactoring we
started to store a pointer to the MIDX in `struct odb_source` itself.

Refactor loading of packfiles in the same way: instead of passing in the
object directory, we now pass in the source from which we want to load
packfiles. This allows us to simplify the code because we don't have to
search for a corresponding MIDX anymore, but we can instead directly use
the MIDX that we have already prepared beforehand.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>midx: start tracking per object database source</title>
<updated>2025-07-15T19:07:28Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-15T11:29:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4d8be89d973b69a826911385c5cf3d40d347394b'/>
<id>urn:sha1:4d8be89d973b69a826911385c5cf3d40d347394b</id>
<content type='text'>
Multi-pack indices are tracked via `struct multi_pack_index`. This data
structure is stored as a linked list inside `struct object_database`,
which is the global database that spans across all of the object
sources.

This layout causes two problems:

  - Object databases consist of multiple object sources (e.g. one source
    per alternate object directory), where each multi-pack index is
    specific to one of those sources. Regardless of that though, the
    MIDX is not tracked per source, but tracked globally for the whole
    object database. This creates a mismatch between the on-disk layout
    and how things are organized in the object database subsystems and
    makes some parts, like figuring out whether a source has an MIDX,
    quite awkward.

  - Multi-pack indices are an implementation detail of how efficient
    access for packfiles work. As such, they are neither relevant in the
    context of loose objects, nor in a potential future where we have
    pluggable backends.

Refactor `prepare_multi_pack_index_one()` so that it works on a specific
source, which allows us to easily store a pointer to the multi-pack
index inside of it. For now, this pointer exists next to the existing
linked list we have in the object database. Users will be adjusted in
subsequent patches to instead use the per-source pointers.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>odb: rename `oid_object_info()`</title>
<updated>2025-07-01T21:46:37Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-01T12:22:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e989dd96b8aa9b20b0e23d3fa845d0baba1b454a'/>
<id>urn:sha1:e989dd96b8aa9b20b0e23d3fa845d0baba1b454a</id>
<content type='text'>
Rename `oid_object_info()` to `odb_read_object_info()` as well as their
`_extended()` variant to match other functions related to the object
database and our modern coding guidelines.

Introduce compatibility wrappers so that any in-flight topics will
continue to compile.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>odb: get rid of `the_repository` when handling alternates</title>
<updated>2025-07-01T21:46:36Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-01T12:22:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c44185f6c10fb2d306efe505112982a7c3b93789'/>
<id>urn:sha1:c44185f6c10fb2d306efe505112982a7c3b93789</id>
<content type='text'>
The functions to manage alternates all depend on `the_repository`.
Refactor them to accept an object database as a parameter and adjust all
callers. The functions are renamed accordingly.

Note that right now the situation is still somewhat weird because we end
up using the object store path provided by the object store's repository
anyway. Consequently, we could have instead passed in a pointer to the
repository instead of passing in the pointer to the object store. This
will be addressed in subsequent commits though, where we will start to
use the path owned by the object store itself.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object-store: rename files to "odb.{c,h}"</title>
<updated>2025-07-01T21:46:34Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-01T12:22:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8f49151763cb81adf4bcec53c1ae67057081b02d'/>
<id>urn:sha1:8f49151763cb81adf4bcec53c1ae67057081b02d</id>
<content type='text'>
In the preceding commits we have renamed the structures contained in
"object-store.h" to `struct object_database` and `struct odb_backend`.
As such, the code files "object-store.{c,h}" are confusingly named now.
Rename them to "odb.{c,h}" accordingly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
