summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorTanay Abhra <tanayabh@gmail.com>2014-08-13 01:22:01 -0700
committerJunio C Hamano <gitster@pobox.com>2014-08-13 12:37:41 -0700
commit0e7bcb1b00179113c0cccb8f2f4768d41cf6fff2 (patch)
treeb23cafce8c065f304fac7fcaf951c40ac2a1e480 /merge-recursive.c
parent6ea358f784a5d8823565a8574d8ed914e51096f4 (diff)
downloadgit-0e7bcb1b00179113c0cccb8f2f4768d41cf6fff2.tar.gz
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>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 1d332b8bbb..8ab944c44c 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -2026,22 +2026,12 @@ int merge_recursive_generic(struct merge_options *o,
return clean ? 0 : 1;
}
-static int merge_recursive_config(const char *var, const char *value, void *cb)
+static void merge_recursive_config(struct merge_options *o)
{
- struct merge_options *o = cb;
- if (!strcmp(var, "merge.verbosity")) {
- o->verbosity = git_config_int(var, value);
- return 0;
- }
- if (!strcmp(var, "diff.renamelimit")) {
- o->diff_rename_limit = git_config_int(var, value);
- return 0;
- }
- if (!strcmp(var, "merge.renamelimit")) {
- o->merge_rename_limit = git_config_int(var, value);
- return 0;
- }
- return git_xmerge_config(var, value, cb);
+ git_config_get_int("merge.verbosity", &o->verbosity);
+ git_config_get_int("diff.renamelimit", &o->diff_rename_limit);
+ git_config_get_int("merge.renamelimit", &o->merge_rename_limit);
+ git_config(git_xmerge_config, NULL);
}
void init_merge_options(struct merge_options *o)
@@ -2052,7 +2042,7 @@ void init_merge_options(struct merge_options *o)
o->diff_rename_limit = -1;
o->merge_rename_limit = -1;
o->renormalize = 0;
- git_config(merge_recursive_config, o);
+ merge_recursive_config(o);
if (getenv("GIT_MERGE_VERBOSITY"))
o->verbosity =
strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);