mirror of
https://github.com/git/git.git
synced 2024-11-18 02:14:03 +01:00
builtin/apply.c: replace git_config()
with git_config_get_string_const()
Use `git_config_get_string_const()` instead of `git_config()` to take advantage of the config-set API which provides a cleaner control flow. Signed-off-by: Tanay Abhra <tanayabh@gmail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0e7bcb1b00
commit
b35b10d463
@ -4269,13 +4269,11 @@ static int apply_patch(int fd, const char *filename, int options)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int git_apply_config(const char *var, const char *value, void *cb)
|
||||
static void git_apply_config(void)
|
||||
{
|
||||
if (!strcmp(var, "apply.whitespace"))
|
||||
return git_config_string(&apply_default_whitespace, var, value);
|
||||
else if (!strcmp(var, "apply.ignorewhitespace"))
|
||||
return git_config_string(&apply_default_ignorewhitespace, var, value);
|
||||
return git_default_config(var, value, cb);
|
||||
git_config_get_string_const("apply.whitespace", &apply_default_whitespace);
|
||||
git_config_get_string_const("apply.ignorewhitespace", &apply_default_ignorewhitespace);
|
||||
git_config(git_default_config, NULL);
|
||||
}
|
||||
|
||||
static int option_parse_exclude(const struct option *opt,
|
||||
@ -4423,7 +4421,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
|
||||
|
||||
prefix = prefix_;
|
||||
prefix_length = prefix ? strlen(prefix) : 0;
|
||||
git_config(git_apply_config, NULL);
|
||||
git_apply_config();
|
||||
if (apply_default_whitespace)
|
||||
parse_whitespace_option(apply_default_whitespace);
|
||||
if (apply_default_ignorewhitespace)
|
||||
|
Loading…
Reference in New Issue
Block a user