]> git.ipfire.org Git - thirdparty/git.git/commit - refs.c
setup: start tracking ref storage format
authorPatrick Steinhardt <ps@pks.im>
Fri, 29 Dec 2023 07:26:39 +0000 (08:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Jan 2024 17:24:47 +0000 (09:24 -0800)
commit173761e21b2978fe7c0f7af7276e8b14511fed23
treeb3055c4af6cb9e747ffa11458fd4d3c22816d4ce
parent0fcc285c5eaab904ea9a8ade2696fe61355cf587
setup: start tracking ref storage format

In order to discern which ref storage format a repository is supposed to
use we need to start setting up and/or discovering the format. This
needs to happen in two separate code paths.

  - The first path is when we create a repository via `init_db()`. When
    we are re-initializing a preexisting repository we need to retain
    the previously used ref storage format -- if the user asked for a
    different format then this indicates an error and we error out.
    Otherwise we either initialize the repository with the format asked
    for by the user or the default format, which currently is the
    "files" backend.

  - The second path is when discovering repositories, where we need to
    read the config of that repository. There is not yet any way to
    configure something other than the "files" backend, so we can just
    blindly set the ref storage format to this backend.

Wire up this logic so that we have the ref storage format always readily
available when needed. As there is only a single backend and because it
is not configurable we cannot yet verify that this tracking works as
expected via tests, but tests will be added in subsequent commits. To
countermand this ommission now though, raise a BUG() in case the ref
storage format is not set up properly in `ref_store_init()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
builtin/init-db.c
refs.c
repository.c
repository.h
setup.c
setup.h