From: Tanay Abhra <tanayabh@gmail.com>
To: git@vger.kernel.org
Cc: Tanay Abhra <tanayabh@gmail.com>,
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
Ramkumar Ramachandra <artagnon@gmail.com>
Subject: [PATCH 3/4] merge-recursive.c: replace `git_config()` with `git_config_get_int()`
Date: Wed, 13 Aug 2014 01:22:01 -0700 [thread overview]
Message-ID: <1407918122-29973-3-git-send-email-tanayabh@gmail.com> (raw)
In-Reply-To: <1407918122-29973-1-git-send-email-tanayabh@gmail.com>
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>
---
merge-recursive.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 1d332b8..8ab944c 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);
--
1.9.0.GIT
next prev parent reply other threads:[~2014-08-13 8:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 8:21 [PATCH 1/4] fast-import.c: replace `git_config()` with `git_config_get_*()` family Tanay Abhra
2014-08-13 8:22 ` [PATCH 2/4] ll-merge.c: refactor `read_merge_config()` to use `git_config_string()` Tanay Abhra
2014-08-13 11:32 ` Matthieu Moy
2014-08-13 12:43 ` [PATCH v2 " Tanay Abhra
2014-08-13 13:07 ` Matthieu Moy
2014-08-13 17:07 ` Junio C Hamano
2014-08-13 8:22 ` Tanay Abhra [this message]
2014-08-13 11:34 ` [PATCH 3/4] merge-recursive.c: replace `git_config()` with `git_config_get_int()` Matthieu Moy
2014-08-13 8:22 ` [PATCH 4/4] builtin/apply.c: replace `git_config()` with `git_config_get_string_const()` Tanay Abhra
2014-08-13 11:24 ` [PATCH 1/4] fast-import.c: replace `git_config()` with `git_config_get_*()` family Matthieu Moy
2014-08-13 12:11 ` Tanay Abhra
2014-08-13 12:22 ` [PATCH v2 1/5] " Tanay Abhra
2014-08-13 13:10 ` Matthieu Moy
2014-08-13 13:33 ` [PATCH/RFC v2 1/2] git_default_config() rewritten using the config-set API Tanay Abhra
2014-08-13 13:39 ` [PATCH/RFC v2 2/2] use the new git_default_config() Tanay Abhra
2014-08-13 16:00 ` [PATCH/RFC v2 1/2] git_default_config() rewritten using the config-set API Matthieu Moy
2014-08-13 17:18 ` Junio C Hamano
2014-08-13 16:16 ` Matthieu Moy
2014-08-13 17:14 ` [PATCH 1/4] fast-import.c: replace `git_config()` with `git_config_get_*()` family Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1407918122-29973-3-git-send-email-tanayabh@gmail.com \
--to=tanayabh@gmail.com \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).