Skip to content

Commit 9be04d6

Browse files
Martin Ågrengitster
authored andcommitted
config: introduce git_parse_maybe_bool_text
Commit 9a549d4 ("config.c: rename git_config_maybe_bool_text and export it as git_parse_maybe_bool", 2015-08-19) intended git_parse_maybe_bool to be a replacement for git_config_maybe_bool, which could then be retired. That is not obvious from the commit message, but that is what the background on the mailing list suggests [1]. However, git_{config,parse}_maybe_bool do not handle all input the same. Before the rename, that was by design and there is a caller in config.c which requires git_parse_maybe_bool to behave exactly as it does. Prepare for the next patch by renaming git_parse_maybe_bool to ..._text and reimplementing the first one as a simple call to the second one. Let the existing users in config.c use ..._text, since it does what they need. [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>
1 parent c4b71a7 commit 9be04d6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

config.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ unsigned long git_config_ulong(const char *name, const char *value)
709709
return ret;
710710
}
711711

712-
int git_parse_maybe_bool(const char *value)
712+
static int git_parse_maybe_bool_text(const char *value)
713713
{
714714
if (!value)
715715
return 1;
@@ -726,9 +726,14 @@ int git_parse_maybe_bool(const char *value)
726726
return -1;
727727
}
728728

729+
int git_parse_maybe_bool(const char *value)
730+
{
731+
return git_parse_maybe_bool_text(value);
732+
}
733+
729734
int git_config_maybe_bool(const char *name, const char *value)
730735
{
731-
int v = git_parse_maybe_bool(value);
736+
int v = git_parse_maybe_bool_text(value);
732737
if (0 <= v)
733738
return v;
734739
if (git_parse_int(value, &v))
@@ -738,7 +743,7 @@ int git_config_maybe_bool(const char *name, const char *value)
738743

739744
int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
740745
{
741-
int v = git_parse_maybe_bool(value);
746+
int v = git_parse_maybe_bool_text(value);
742747
if (0 <= v) {
743748
*is_bool = 1;
744749
return v;

0 commit comments

Comments
 (0)