diff options
author | Martin Ågren <martin.agren@gmail.com> | 2017-08-07 20:20:48 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-07 13:27:24 -0700 |
commit | 4666741823239ed45ce9a63914dfd3c1601cf868 (patch) | |
tree | 6c5e8009ab38dcbcf1e323831b67f0fd5b8f9ef1 /unpack-trees.c | |
parent | config: introduce git_parse_maybe_bool_text (diff) | |
download | tgif-4666741823239ed45ce9a63914dfd3c1601cf868.tar.xz |
config: make git_{config,parse}_maybe_bool equivalent
Both of these act on a string `value` which they parse as a boolean. The
"parse"-variant was introduced as a replacement for the "config"-variant
which for historical reasons takes an unused argument `name`. That it
was intended as a replacement is not obvious from commit 9a549d43
("config.c: rename git_config_maybe_bool_text and export it as
git_parse_maybe_bool", 2015-08-19), but that is what the background on
the mailing list suggests [1].
However, these two functions do not parse `value` in exactly the same
way. In particular, git_config_maybe_bool accepts integers (0 for false,
non-0 for true). This means there are two slightly different definitions
of "maybe_bool" in the code-base, and that every time a call to
git_config_maybe_bool is changed to use git_parse_maybe_bool, it risks
breaking someone's workflow.
Move the implementation of "config" into "parse" and make the latter a
trivial wrapper.
This also fixes the only user of git_parse_maybe_bool, `git push
--signed=..`.
[1] https://public-inbox.org/git/xmqq7fotd71o.fsf@gitster.dls.corp.google.com/
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
0 files changed, 0 insertions, 0 deletions