Skip to content

Commit

Permalink
merge-recursive.c: replace git_config() with git_config_get_int()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tanay Abhra authored and Junio C Hamano committed Aug 13, 2014
1 parent 6ea358f commit 0e7bcb1
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down

0 comments on commit 0e7bcb1

Please sign in to comment.