Re: [PATCH] advice: use global config for default branch name
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 8, 2026, 18:57 UTC
- Message-ID
- <xmqqik4fwoz5.fsf@gitster.g>
- In-Reply-To
- <20260908213840.37833-1-ub4nal@mail.ru>
Vsevolod Myalitsin <ub4nal@mail.ru> writes:
> Yes, I agree that passing the "advice_setting" itself is cleaner and > more future-proof. I will change "vadvise()" to take a pointer to the > corresponding "advice_setting" instead.
One minor glitch is that there is an ad-hoc vadvise() call in advise() that is not tied to any particular entry in the advise_setting[] table. I think we'd need to give a name to the advice_setting struct type, instanciate an ad-hoc instance on stack, and pass it down the callchain, perhaps like so:
void advise(const char *advice, ...)
{
struct advice_setting ad_hoc = {
.key = "",
.scope = CONFIG_SCOPE_UNKNOWN,
.level = 0,
};
va_list params;va_start(params, advise); vadvise(advise, &ad_hoc, params); va_end(params); }