diff options
author | Patrick Steinhardt <ps@pks.im> | 2023-12-29 08:26:39 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-02 18:24:47 +0100 |
commit | 173761e21b2978fe7c0f7af7276e8b14511fed23 (patch) | |
tree | b3055c4af6cb9e747ffa11458fd4d3c22816d4ce /refs.c | |
parent | refs: refactor logic to look up storage backends (diff) | |
download | git-173761e21b2978fe7c0f7af7276e8b14511fed23.tar.xz git-173761e21b2978fe7c0f7af7276e8b14511fed23.zip |
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>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2045,10 +2045,10 @@ static struct ref_store *ref_store_init(struct repository *repo, const char *gitdir, unsigned int flags) { - unsigned int format = REF_STORAGE_FORMAT_FILES; - const struct ref_storage_be *be = find_ref_storage_backend(format); + const struct ref_storage_be *be; struct ref_store *refs; + be = find_ref_storage_backend(repo->ref_storage_format); if (!be) BUG("reference backend is unknown"); |