MCPcopy Create free account
hub / github.com/git/git / git_default_advice_config

Function git_default_advice_config

advice.c:162–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162int 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
195void list_config_advices(struct string_list *list, const char *prefix)
196{

Callers 1

git_default_configFunction · 0.85

Calls 5

git_config_colorboolFunction · 0.85
parse_advise_color_slotFunction · 0.85
config_error_nonboolFunction · 0.85
color_parseFunction · 0.85
git_config_boolFunction · 0.85

Tested by

no test coverage detected