Re: [PATCH v4 2/3] advice: introduce advice scoping mechanism
Vsevolod Myalitsin <ub4nal@mail.ru> writes:
Show 16 quoted lines
> @@ -109,8 +117,21 @@ static void vadvise(const char *advice,
> strbuf_vaddf(&buf, advice, params);
>
> if (setting && setting->level == ADVICE_LEVEL_NONE) {
> + const char *scope = "";
> + switch (setting->scope_hint) {
> + case CONFIG_SCOPE_LOCAL:
> + case CONFIG_SCOPE_UNKNOWN:
> + break;
> + case CONFIG_SCOPE_GLOBAL:
> + scope = " --global";
> + break;
> + case CONFIG_SCOPE_SYSTEM:
> + scope = " --system";
> + break;
> + }make DEVELOPER=YesPlease would die due to
advice.c: In function 'vadvise':
advice.c:123:17: error: enumeration value 'CONFIG_SCOPE_WORKTREE' not handled in switch [-Werror=switch]
123 | switch (setting->scope_hint) {
| ^~~~~~
advice.c:123:17: error: enumeration value 'CONFIG_SCOPE_COMMAND' not handled in switch [-Werror=switch]
advice.c:123:17: error: enumeration value 'CONFIG_SCOPE_SUBMODULE' not handled in switch [-Werror=switch]We probably should have
default:
BUG("advice settings at wrong config scope");or something there.
Show 7 quoted lines
> strbuf_addf(&buf, turn_off_instructions,
> - setting->key);
> + scope, setting->key);
> + }
>
> for (cp = buf.buf; *cp; cp = np) {
> np = strchrnul(cp, '\n');