Re: [PATCH v3 1/5] setup: create ref and object databases after config is written

Karthik Nayak <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CAOLa=ZT-ObRJ3t0XYAkL33CPDZ2ULu_5M7c477rr0pZBqTBi9w@mail.gmail.com>
Patrick Steinhardt <[email protected]> writes:

> 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.
>

Okay so this is the new patch in this version. So since we now read
config as part of object database creation, that means we would need to
know the value of 'core.sharedRepository' and that can't happen if the
odb is initialized before that. Alright makes sense.

>
> Signed-off-by: Patrick Steinhardt <[email protected]>
> ---
>  setup.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/setup.c b/setup.c
> index 20d29f31f4..d90654f584 100644
> --- a/setup.c
> +++ b/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);
>
>
> --
> 2.55.0.822.g20453c30eb.dirty
signature.asc (application/pgp-signature, 690 B)
-----BEGIN PGP SIGNATURE-----

iQHKBAEBCgA0FiEEV85Mf2N1cQ/LZcYGPtWfJI5GjH8FAmqGxFkWHGthcnRoaWsu
MTg4QGdtYWlsLmNvbQAKCRA+1Z8kjkaMf/9OC/4/znhiQgWkhWnuN73EQ49Sonll
oO1ACOXGRYu4dT+Poc2mw/7ncZg9+Q8EeOB28sKMZAxQmEtg7ynjJz5lBZzDlL9a
UXyG87oMlzbB9fz6v8MclzyKY00PZYu439gn+BtcgmO/MD4p/9UWgLQFgiDjhlRY
W/9k+nU0XGLcXWwJNbVg5k2+mghA3wCj5Nn+VggUaTdgu6p74S2A5UnDU1qYCnTf
ZvbWFGChDZeDvwTMf4jakjovgEA4ymCxO5/QjDseicpIoEhOEDQBzufEeGM116vo
aqWH8V06iwjvw7XmIvc5HkXgVVIMtb8bi+BbJi7gAgcx1x/8lfdGsIOJd1YGHiYr
ixO4PWgIKowGkWWc2HH6Oi1niLLYWz+2jm80OQStjpuFZr29Hu0BKWbMc4CnpYNf
hdbjkEQmjcKltZ7ulmPbb0vFFG/dm/AjHN6CD5ZhGIsRvJpnj4A3SGL9qnAbytFw
FxFOdRpN7Vz8HLE56h6KZXtrFSXbh2hKF5BAkjM=
=vP7X
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.