setup: create ref and object databases after config is written
When creating a new repository we create both the reference and object databases after we have finalized the repository. This ensures that those subsystems find a fully-configured repository at the time where they are asked to create their own on-disk data structures. There is one exception though: while we have already fully configured the repository at this point, we haven't yet written both "core.sharedRepository" and "receive.denyNonFastforwards". The latter configuration doesn't really matter to us, but the first one does as the "files" object database source reads it. This doesn't cause any problems right now, but it will in a subsequent patch where we will start to read "core.ignoreCase" when creating the object database. Move the initialization of both of these data structures towards the end of `init_db()`. The only thing that now comes after is status reporting, but that's it. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>main
parent
d296c52baa
commit
1c46ce6dda
12
setup.c
12
setup.c
|
|
@ -2880,12 +2880,6 @@ int init_db(struct repository *repo,
|
|||
reinit = create_default_files(repo, template_dir, original_git_dir,
|
||||
&repo_fmt, init_shared_repository);
|
||||
|
||||
if (!(flags & INIT_DB_SKIP_REFDB))
|
||||
create_reference_database(repo, initial_branch, flags & INIT_DB_QUIET);
|
||||
create_object_database(repo);
|
||||
|
||||
startup_info->have_repository = 1;
|
||||
|
||||
if (repo_settings_get_shared_repository(repo)) {
|
||||
char buf[10];
|
||||
/* We do not spell "group" and such, so that
|
||||
|
|
@ -2907,6 +2901,12 @@ int init_db(struct repository *repo,
|
|||
repo_config_set(repo, "receive.denyNonFastforwards", "true");
|
||||
}
|
||||
|
||||
if (!(flags & INIT_DB_SKIP_REFDB))
|
||||
create_reference_database(repo, initial_branch, flags & INIT_DB_QUIET);
|
||||
create_object_database(repo);
|
||||
|
||||
startup_info->have_repository = 1;
|
||||
|
||||
if (!(flags & INIT_DB_QUIET)) {
|
||||
int len = strlen(git_dir);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue