| 160 | } |
| 161 | |
| 162 | int git_default_advice_config(const char *var, const char *value) |
| 163 | { |
| 164 | const char *k, *slot_name; |
| 165 | |
| 166 | if (!strcmp(var, "color.advice")) { |
| 167 | advice_use_color = git_config_colorbool(var, value); |
| 168 | return 0; |
| 169 | } |
| 170 | |
| 171 | if (skip_prefix(var, "color.advice.", &slot_name)) { |
| 172 | int slot = parse_advise_color_slot(slot_name); |
| 173 | if (slot < 0) |
| 174 | return 0; |
| 175 | if (!value) |
| 176 | return config_error_nonbool(var); |
| 177 | return color_parse(value, advice_colors[slot]); |
| 178 | } |
| 179 | |
| 180 | if (!skip_prefix(var, "advice.", &k)) |
| 181 | return 0; |
| 182 | |
| 183 | for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++) { |
| 184 | if (strcasecmp(k, advice_setting[i].key)) |
| 185 | continue; |
| 186 | advice_setting[i].level = git_config_bool(var, value) |
| 187 | ? ADVICE_LEVEL_ENABLED |
| 188 | : ADVICE_LEVEL_DISABLED; |
| 189 | return 0; |
| 190 | } |
| 191 | |
| 192 | return 0; |
| 193 | } |
| 194 | |
| 195 | void list_config_advices(struct string_list *list, const char *prefix) |
| 196 | { |
no test coverage detected