Re: [PATCH] advice: refactor advise API
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 10, 2020, 22:46 UTC
- Message-ID
- <xmqqeev2xdq8.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <pull.548.git.1581311049547.gitgitgadget@gmail.com>
"Heba Waly via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 11 quoted lines
> A new advise_ng() is introduced to gradually replace advise()
>
> pros of the new advise():
>
> * The caller doesn't need to define a new global variable when
> introducing a new message.
> * The caller doesn't need to check the visibility of the message before
> calling advise_ng().
> * The caller still needs to come up with advice.frotz config variable
> and will call advice_ng as follows: advice_ng("advice.frotz",
> _("helpful message about frotz"));Readers would expect to see "cons of the same" to follow "pros".
> After this patch the plan is to migrate the rest of the advise calls to > advise_ng and then finally remove advise() and rename advise_ng() to > advise()
As I outlined in [1], I think the over-simplified "advise_ng(<advise.key>, _(<message>), ...)" would be too limited to replace the current users, without a pair of helper functions, one to just check for the guarding advise.key, and the other to unconditionally show the message (i.e. the latter is what the current advise() is).
> [1] > https://public-inbox.org/git/xmqqzhf5cw69.fsf@gitster-ct.c.googlers.com/