]> git.ipfire.org Git - thirdparty/git.git/commit
setup: detangle loading of loose object maps
authorPatrick Steinhardt <ps@pks.im>
Fri, 24 Jul 2026 03:48:41 +0000 (05:48 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Jul 2026 17:21:44 +0000 (10:21 -0700)
commit109e40dfcb18c4555aecb6c41a650d114a3bec7b
treee1cd589afc37297ea607e5656af5d865e9db1e05
parent5c0bc1d8889f21964bfb213f06baa91ba74ef964
setup: detangle loading of loose object maps

When a repository is configured to use a compatibility hash function
then we load the loose object map when we initialize the repository.
This object map provides the mappings between the canonical object hash
and the compatibility object hash.

Loading the object map happens in `repo_set_compat_hash_algo()`, which
calls `repo_read_loose_object_map()` in case the compatibility object
hash is non-zero. This setup sequence has two major downsides:

  - We assume that the primary object database is the "files" object
    database so that we can extract its "loose" backend. This stops
    working with pluggable object databases.

  - We require the object database to already have been initialized when
    configuring the object database. This means that we must intermix
    configuration of the repository and initialization of its
    sub-structures in a weird way.

Refactor the logic so that we instead load the loose object map via the
"loose" backend, which fixes both of the above issues.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
loose.c
loose.h
odb/source-loose.c
repository.c
setup.c