| 1185 | } |
| 1186 | |
| 1187 | NORETURN |
| 1188 | static void die_bad_number(const char *name, const char *value, |
| 1189 | const struct key_value_info *kvi) |
| 1190 | { |
| 1191 | const char *error_type = (errno == ERANGE) ? |
| 1192 | N_("out of range") : N_("invalid unit"); |
| 1193 | const char *bad_numeric = N_("bad numeric config value '%s' for '%s': %s"); |
| 1194 | |
| 1195 | if (!kvi) |
| 1196 | BUG("kvi should not be NULL"); |
| 1197 | |
| 1198 | if (!value) |
| 1199 | value = ""; |
| 1200 | |
| 1201 | if (!kvi->filename) |
| 1202 | die(_(bad_numeric), value, name, _(error_type)); |
| 1203 | |
| 1204 | switch (kvi->origin_type) { |
| 1205 | case CONFIG_ORIGIN_BLOB: |
| 1206 | die(_("bad numeric config value '%s' for '%s' in blob %s: %s"), |
| 1207 | value, name, kvi->filename, _(error_type)); |
| 1208 | case CONFIG_ORIGIN_FILE: |
| 1209 | die(_("bad numeric config value '%s' for '%s' in file %s: %s"), |
| 1210 | value, name, kvi->filename, _(error_type)); |
| 1211 | case CONFIG_ORIGIN_STDIN: |
| 1212 | die(_("bad numeric config value '%s' for '%s' in standard input: %s"), |
| 1213 | value, name, _(error_type)); |
| 1214 | case CONFIG_ORIGIN_SUBMODULE_BLOB: |
| 1215 | die(_("bad numeric config value '%s' for '%s' in submodule-blob %s: %s"), |
| 1216 | value, name, kvi->filename, _(error_type)); |
| 1217 | case CONFIG_ORIGIN_CMDLINE: |
| 1218 | die(_("bad numeric config value '%s' for '%s' in command line %s: %s"), |
| 1219 | value, name, kvi->filename, _(error_type)); |
| 1220 | default: |
| 1221 | die(_("bad numeric config value '%s' for '%s' in %s: %s"), |
| 1222 | value, name, kvi->filename, _(error_type)); |
| 1223 | } |
| 1224 | } |
| 1225 | |
| 1226 | int git_config_int(const char *name, const char *value, |
| 1227 | const struct key_value_info *kvi) |
no test coverage detected