diff options
author | Tanay Abhra <tanayabh@gmail.com> | 2014-08-13 01:22:02 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-08-13 12:37:47 -0700 |
commit | b35b10d463fbc274a2edd006f6f5ab46e66a4722 (patch) | |
tree | 921b053245a1aaa356a48016f75b4a4f81e84ebe /builtin/apply.c | |
parent | merge-recursive.c: replace `git_config()` with `git_config_get_int()` (diff) | |
download | tgif-b35b10d463fbc274a2edd006f6f5ab46e66a4722.tar.xz |
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>
Diffstat (limited to 'builtin/apply.c')
-rw-r--r-- | builtin/apply.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/builtin/apply.c b/builtin/apply.c index 9f8f5bac07..b97a55d3a7 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -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) |