Add config_error_nonbool() helper function
This is used to report misconfigured configuration file that does not give any value to a non-boolean variable, e.g. [section] var It is perfectly fine to say it if the section.var is a boolean (it means true), but if a variable expects a string value it should be flagged as a configuration error. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
9
config.c
9
config.c
@ -1079,3 +1079,12 @@ int git_config_rename_section(const char *old_name, const char *new_name)
|
||||
free(config_filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call this to report error for your variable that should not
|
||||
* get a boolean value (i.e. "[my] var" means "true").
|
||||
*/
|
||||
int config_error_nonbool(const char *var)
|
||||
{
|
||||
return error("Missing value for '%s'", var);
|
||||
}
|
||||
|
Reference in New Issue
Block a user