Re: [Outreachy PATCH v6 1/3] environment: stop storing `core.attributesFile` globally
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 11, 2026, 16:46 UTC
- Message-ID
- <xmqq5x83w7m1.fsf@gitster.g>
- In-Reply-To
- <37abfe28-ff89-460a-962d-4503ec3f7975@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 21 quoted lines
> Thanks for the backtrace which helped me spot the problem though I
> should have spotted this yesterday. The problem is in
> initialize_repository()
>
>> void initialize_repository(struct repository *repo)
>> {
>> + if (repo->initialized)
>> + BUG("repository initialized already");
>> + repo->initialized = true;
>> +
>> repo->remote_state = remote_state_new();
>> repo->parsed_objects = parsed_object_pool_new(repo);
>> ALLOC_ARRAY(repo->index, 1);
>> index_state_init(repo->index, repo);
>> repo->check_deprecated_config = true;
>> + repo_config_values_init(repo_config_values(repo));
>
> Here you need to use repo->config_values_private_ instead of using the
> accessor as it is fine to initialize the config values to their defaults
> in any instance, it is only when we read them that we want to assert
> that we're reading from "the_repository".Sorry, but ...
At the beginning of repo_config_values() in the patch, there is a check to ensure that repo->initialized is true and otherwise you get an error. But the initialization is already done in the early part of initialize_repository() as quoted above. So I do not see what difference it would make if we rewrote the last line as
repo_config_values_init(&repo->config_values_private_);
I am confused.