Subject: Re: [PATCH v4 8/8] environment: move "warn_on_object_refname_ambiguity" into `struct repo_config_values`

From: Junio C Hamano <[email-masked]>
Date: Tue, 02 Jun 2026 09:05:57 +0900

Olamide Caleb Bello <[email-masked]> writes:

> @@ -684,11 +684,12 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
>  	int refs_found = 0;
>  	int at, reflog_len, nth_prior = 0;
>  	int fatal = !(flags & GET_OID_QUIETLY);
> +	struct repo_config_values *cfg = repo_config_values(the_repository);

The theme of this topic, however, is to turn the process-wide global
into per-repository setting, so it may appear to be a bit unrelated
change, but the function already takes a repository instance, which
may be different from the_repository.  In the longer run, we
definitely want to see this call pass 'r' instead of
'the_repository', after making sure that repo-config-values for
repository 'r' has already been properly initialized in the program
flow that leads here.

If we want to be conservative, keep the call passing the_repository,
but leave an in-code comment 

	/*
	 * NEEDSWORK: pass 'r' instead of the_repository after
	 * making sure that repo_config_values for 'r' does have
	 * the right value for the repository.
	 */

or something like that nearby.

> diff --git a/submodule.c b/submodule.c
> index b1a0363f9d..f26235bbb7 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -898,12 +898,13 @@ static void collect_changed_submodules(struct repository *r,
>  	struct setup_revision_opt s_r_opt = {
>  		.assume_dashdash = 1,
>  	};
> +	struct repo_config_values *cfg = repo_config_values(the_repository);

Likewise.

There may be other places with the same issue I may have missed.