merge-recursive.c: replace `git_config()` with `git_config_get_int()`

Use `git_config_get_int()` 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>

Tanay Abhra committed Aug 13, 2014 at 01:22 UTC 0e7bcb1b00179113c0cccb8f2f4768d41cf6fff2
1 file changed +6 -16
merge-recursive.c
+6 -16
@@ -2026,22 +2026,12 @@ int merge_recursive_generic(struct merge_options *o,
2026 return clean ? 0 : 1;
2027 }
2028
2029 -static int merge_recursive_config(const char *var, const char *value, void *cb)
2029 +static void merge_recursive_config(struct merge_options *o)
2030 {
2031 - struct merge_options *o = cb;
2032 - if (!strcmp(var, "merge.verbosity")) {
2033 - o->verbosity = git_config_int(var, value);
2034 - return 0;
2035 - }
2036 - if (!strcmp(var, "diff.renamelimit")) {
2037 - o->diff_rename_limit = git_config_int(var, value);
2038 - return 0;
2039 - }
2040 - if (!strcmp(var, "merge.renamelimit")) {
2041 - o->merge_rename_limit = git_config_int(var, value);
2042 - return 0;
2043 - }
2044 - return git_xmerge_config(var, value, cb);
2031 + git_config_get_int("merge.verbosity", &o->verbosity);
2032 + git_config_get_int("diff.renamelimit", &o->diff_rename_limit);
2033 + git_config_get_int("merge.renamelimit", &o->merge_rename_limit);
2034 + git_config(git_xmerge_config, NULL);
2035 }
2036
2037 void init_merge_options(struct merge_options *o)
@@ -2052,7 +2042,7 @@ void init_merge_options(struct merge_options *o)
2042 o->diff_rename_limit = -1;
2043 o->merge_rename_limit = -1;
2044 o->renormalize = 0;
2055 - git_config(merge_recursive_config, o);
2045 + merge_recursive_config(o);
2046 if (getenv("GIT_MERGE_VERBOSITY"))
2047 o->verbosity =
2048 strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);