Patrick Steinhardt <ps@xxxxxx> writes: > 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 erorr and we error out. Nit: s/erorr/error > diff --git a/refs.c b/refs.c > index e87c85897d..d289a5e175 100644 > --- a/refs.c > +++ b/refs.c > @@ -2045,12 +2045,12 @@ static struct ref_store *ref_store_init(struct repository *repo, > const char *gitdir, > unsigned int flags) > { > - 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 %s is unknown", ref_storage_format_to_name(format)); > + BUG("reference backend is unknown"); > > refs = be->init(repo, gitdir, flags); > return refs; > diff --git a/refs.h b/refs.h > index c6571bcf6c..944a67ac1b 100644 > --- a/refs.h > +++ b/refs.h > @@ -11,6 +11,7 @@ struct string_list; > struct string_list_item; > struct worktree; > > +int default_ref_storage_format(void); > Is this used/defined somewhere?