Skip to content

Commit 0e7bcb1

Browse files
tanayabhgitster
authored andcommitted
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 <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ea358f commit 0e7bcb1

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

merge-recursive.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,22 +2026,12 @@ int merge_recursive_generic(struct merge_options *o,
20262026
return clean ? 0 : 1;
20272027
}
20282028

2029-
static int merge_recursive_config(const char *var, const char *value, void *cb)
2029+
static void merge_recursive_config(struct merge_options *o)
20302030
{
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);
20452035
}
20462036

20472037
void init_merge_options(struct merge_options *o)
@@ -2052,7 +2042,7 @@ void init_merge_options(struct merge_options *o)
20522042
o->diff_rename_limit = -1;
20532043
o->merge_rename_limit = -1;
20542044
o->renormalize = 0;
2055-
git_config(merge_recursive_config, o);
2045+
merge_recursive_config(o);
20562046
if (getenv("GIT_MERGE_VERBOSITY"))
20572047
o->verbosity =
20582048
strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);

0 commit comments

Comments
 (0)