Re: [PATCH v2 02/12] builtin/verify-tag: stop using `the_repository`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 27, 2025, 22:39 UTC
- Message-ID
- <xmqqsenz57xu.fsf@gitster.g>
- In-Reply-To
- <CAPSxiM-bOcqEbVNAYxh0oPXKceN7YSrCU_37e7mXAbxwpq3QNQ@mail.gmail.com>
Usman Akinyemi <usmanakinyemi202@gmail.com> writes:
Show 6 quoted lines
> While going through the config.c I saw the > read_very_early_config() which read the config from the system and > global settings and does not require any repo variable. I think, > to teach the repo_config() to allow NULL value, we could call the > read_very_early_config() whenever the repo is NULL as we know, > this happens outside the repository.
Yeah, when I wrote the message you were responding to, I noticed that do_git_config_sequence() is prepared to take NULL as repo (even though it is a bit clunky interface; you need to futz with members of the opts structure like opts->ignore_repo to have the code ignore repo that is NULL). So a caller that calls config_with_options() with no config_source and no repo should be a good candidate to reuse.
As we positively know that we are not in a repository in our case, using read_very_early_config() when repo is NULL sounds like a sensible thing to do, I would think.
Thanks.