Re: [PATCH v2 1/2] advice: refactor advise API
- From
Heba Waly <heba.waly@gmail.com>
- Date
- Feb 19, 2020, 09:59 UTC
- Message-ID
- <CACg5j25yoXi_aAwd0uf7ZgiCPE23Ej89bSnPiz1vxrhWNmkK3g@mail.gmail.com>
- In-Reply-To
- <080d12b5c696d61ac1052d5863f7260a4005346e.1581889150.git.gitgitgadget@gmail.com>
On Mon, Feb 17, 2020 at 10:39 AM Heba Waly via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 15 quoted lines
>
> +int advice_enabled(enum advice_type type)
> +{
> + int value = 1;
> + char *key = xstrfmt("%s.%s", "advice", advice_config_keys[type]);
> + git_config_get_bool(key, &value);
> + return value;
> +}
> +
> +int advice_push_update_rejected_enabled(void)
> +{
> + return advice_enabled(PUSH_UPDATE_REJECTED) ||
> + advice_enabled(PUSH_UPDATE_REJECTED_ALIAS);
> +
> +}I just realized that the return value in this function should be && instead of || (if any of the config variables is 0, then the advice should be disabled), will fix that in the next round.
I'll probably remove this function and add a switch case to advice_enabled() to handle this case as well as another one that I came across while migrating the rest of the calls to the new helpers. Will post an updated version soon.
> -- > gitgitgadget >