summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2017-08-07 20:20:49 +0200
committerJunio C Hamano <gitster@pobox.com>2017-08-07 13:29:22 -0700
commit8957661378b073b49875059d6426614facb0d7f0 (patch)
treed0ab9bbeb05fc9687b9823876bc1322fd2b35453 /builtin
parent4666741823239ed45ce9a63914dfd3c1601cf868 (diff)
downloadgit-8957661378b073b49875059d6426614facb0d7f0.tar.gz
treewide: deprecate git_config_maybe_bool, use git_parse_maybe_bool
The only difference between these is that the former takes an argument `name` which it ignores completely. Still, the callers are quite careful to provide reasonable values for it. Once in-flight topics have landed, we should be able to remove git_config_maybe_bool. In the meantime, document it as deprecated in the technical documentation. While at it, document git_parse_maybe_bool. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/log.c4
-rw-r--r--builtin/merge.c4
-rw-r--r--builtin/pull.c4
-rw-r--r--builtin/push.c2
-rw-r--r--builtin/remote.c2
-rw-r--r--builtin/send-pack.c2
6 files changed, 9 insertions, 9 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 55d20cc2d8..c9564da84f 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -54,7 +54,7 @@ struct line_opt_callback_data {
static int parse_decoration_style(const char *var, const char *value)
{
- switch (git_config_maybe_bool(var, value)) {
+ switch (git_parse_maybe_bool(value)) {
case 1:
return DECORATE_SHORT_REFS;
case 0:
@@ -809,7 +809,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
return 0;
}
if (!strcmp(var, "format.from")) {
- int b = git_config_maybe_bool(var, value);
+ int b = git_parse_maybe_bool(value);
free(from);
if (b < 0)
from = xstrdup(value);
diff --git a/builtin/merge.c b/builtin/merge.c
index a96d4fb501..f9fe5c9d78 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -566,7 +566,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)
else if (!strcmp(k, "merge.renormalize"))
option_renormalize = git_config_bool(k, v);
else if (!strcmp(k, "merge.ff")) {
- int boolval = git_config_maybe_bool(k, v);
+ int boolval = git_parse_maybe_bool(v);
if (0 <= boolval) {
fast_forward = boolval ? FF_ALLOW : FF_NO;
} else if (v && !strcmp(v, "only")) {
@@ -959,7 +959,7 @@ static int default_edit_option(void)
return 0;
if (e) {
- int v = git_config_maybe_bool(name, e);
+ int v = git_parse_maybe_bool(e);
if (v < 0)
die(_("Bad value '%s' in environment '%s'"), e, name);
return v;
diff --git a/builtin/pull.c b/builtin/pull.c
index 3ecb881b0b..1c0eb27c37 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -36,7 +36,7 @@ enum rebase_type {
static enum rebase_type parse_config_rebase(const char *key, const char *value,
int fatal)
{
- int v = git_config_maybe_bool("pull.rebase", value);
+ int v = git_parse_maybe_bool(value);
if (!v)
return REBASE_FALSE;
@@ -271,7 +271,7 @@ static const char *config_get_ff(void)
if (git_config_get_value("pull.ff", &value))
return NULL;
- switch (git_config_maybe_bool("pull.ff", value)) {
+ switch (git_parse_maybe_bool(value)) {
case 0:
return "--no-ff";
case 1:
diff --git a/builtin/push.c b/builtin/push.c
index 5c22e9f2e5..1410b66d0e 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -480,7 +480,7 @@ static int git_push_config(const char *k, const char *v, void *cb)
} else if (!strcmp(k, "push.gpgsign")) {
const char *value;
if (!git_config_get_value("push.gpgsign", &value)) {
- switch (git_config_maybe_bool("push.gpgsign", value)) {
+ switch (git_parse_maybe_bool(value)) {
case 0:
set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_NEVER);
break;
diff --git a/builtin/remote.c b/builtin/remote.c
index 5339ed6ad1..ecd7b3a8cc 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -300,7 +300,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)
}
string_list_append(&info->merge, xstrdup(value));
} else {
- int v = git_config_maybe_bool(orig_key, value);
+ int v = git_parse_maybe_bool(value);
if (v >= 0)
info->rebase = v;
else if (!strcmp(value, "preserve"))
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 1ff5a67538..a3d68d60ab 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -104,7 +104,7 @@ static int send_pack_config(const char *k, const char *v, void *cb)
if (!strcmp(k, "push.gpgsign")) {
const char *value;
if (!git_config_get_value("push.gpgsign", &value)) {
- switch (git_config_maybe_bool("push.gpgsign", value)) {
+ switch (git_parse_maybe_bool(value)) {
case 0:
args.push_cert = SEND_PACK_PUSH_CERT_NEVER;
break;