builtin/config: pull out function to handle --null
Pull out function to handle the `--null` option, which we are about to reuse in subsequent commits. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
9dda6b72b7
commit
fee3796616
@ -698,6 +698,14 @@ static void handle_config_location(const char *prefix)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_nul(void) {
|
||||||
|
if (end_nul) {
|
||||||
|
term = '\0';
|
||||||
|
delim = '\n';
|
||||||
|
key_delim = '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct option builtin_config_options[] = {
|
static struct option builtin_config_options[] = {
|
||||||
OPT_GROUP(N_("Config file location")),
|
OPT_GROUP(N_("Config file location")),
|
||||||
OPT_BOOL(0, "global", &use_global_config, N_("use global config file")),
|
OPT_BOOL(0, "global", &use_global_config, N_("use global config file")),
|
||||||
@ -760,12 +768,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
|
|||||||
PARSE_OPT_STOP_AT_NON_OPTION);
|
PARSE_OPT_STOP_AT_NON_OPTION);
|
||||||
|
|
||||||
handle_config_location(prefix);
|
handle_config_location(prefix);
|
||||||
|
handle_nul();
|
||||||
if (end_nul) {
|
|
||||||
term = '\0';
|
|
||||||
delim = '\n';
|
|
||||||
key_delim = '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) {
|
if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) {
|
||||||
error(_("--get-color and variable type are incoherent"));
|
error(_("--get-color and variable type are incoherent"));
|
||||||
|
Reference in New Issue
Block a user