diff mbox series

[v2] config.c: remove last remnant of GIT_TEST_GETTEXT_POISON

Message ID patch-1.1-2b2ac8471f-20210408T132357Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit 39e12650d71d5ecf195a31eb096ff1d140be2467
Headers show
Series [v2] config.c: remove last remnant of GIT_TEST_GETTEXT_POISON | expand

Commit Message

Ævar Arnfjörð Bjarmason April 8, 2021, 1:25 p.m. UTC
Remove a use of GIT_TEST_GETTEXT_POISON added in f276e2a4694 (config:
improve error message for boolean config, 2021-02-11).

This was simultaneously in-flight with my d162b25f956 (tests: remove
support for GIT_TEST_GETTEXT_POISON, 2021-01-20) which removed the
rest of the GIT_TEST_GETTEXT_POISON code.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

This trivial cleanup now without the objectionable and needless change
to the tests.

Range-diff:
1:  ea968affa8 ! 1:  2b2ac8471f config.c: remove last remnant of GIT_TEST_GETTEXT_POISON
    @@ config.c: int git_config_bool(const char *name, const char *value)
      	return v;
      }
      
    -
    - ## t/t1300-config.sh ##
    -@@ t/t1300-config.sh: test_expect_success 'invalid unit boolean' '
    - 	git config commit.gpgsign "1true" &&
    - 	test_cmp_config 1true commit.gpgsign &&
    - 	test_must_fail git config --bool --get commit.gpgsign 2>actual &&
    --	test_i18ngrep "bad boolean config value .1true. for .commit.gpgsign." actual
    -+	grep "bad boolean config value .1true. for .commit.gpgsign." actual
    - '
    - 
    - test_expect_success 'line number is reported correctly' '

 config.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

Comments

Junio C Hamano April 8, 2021, 5:55 p.m. UTC | #1
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> Remove a use of GIT_TEST_GETTEXT_POISON added in f276e2a4694 (config:
> improve error message for boolean config, 2021-02-11).

Thanks.  Will queue.

>
> This was simultaneously in-flight with my d162b25f956 (tests: remove
> support for GIT_TEST_GETTEXT_POISON, 2021-01-20) which removed the
> rest of the GIT_TEST_GETTEXT_POISON code.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>
> This trivial cleanup now without the objectionable and needless change
> to the tests.
>
> Range-diff:
> 1:  ea968affa8 ! 1:  2b2ac8471f config.c: remove last remnant of GIT_TEST_GETTEXT_POISON
>     @@ config.c: int git_config_bool(const char *name, const char *value)
>       	return v;
>       }
>       
>     -
>     - ## t/t1300-config.sh ##
>     -@@ t/t1300-config.sh: test_expect_success 'invalid unit boolean' '
>     - 	git config commit.gpgsign "1true" &&
>     - 	test_cmp_config 1true commit.gpgsign &&
>     - 	test_must_fail git config --bool --get commit.gpgsign 2>actual &&
>     --	test_i18ngrep "bad boolean config value .1true. for .commit.gpgsign." actual
>     -+	grep "bad boolean config value .1true. for .commit.gpgsign." actual
>     - '
>     - 
>     - test_expect_success 'line number is reported correctly' '
>
>  config.c | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/config.c b/config.c
> index 6428393a41..870d9534de 100644
> --- a/config.c
> +++ b/config.c
> @@ -1180,20 +1180,6 @@ static void die_bad_number(const char *name, const char *value)
>  	}
>  }
>  
> -NORETURN
> -static void die_bad_bool(const char *name, const char *value)
> -{
> -	if (!strcmp(name, "GIT_TEST_GETTEXT_POISON"))
> -		/*
> -		 * We explicitly *don't* use _() here since it would
> -		 * cause an infinite loop with _() needing to call
> -		 * use_gettext_poison().
> -		 */
> -		die("bad boolean config value '%s' for '%s'", value, name);
> -	else
> -		die(_("bad boolean config value '%s' for '%s'"), value, name);
> -}
> -
>  int git_config_int(const char *name, const char *value)
>  {
>  	int ret;
> @@ -1268,7 +1254,7 @@ int git_config_bool(const char *name, const char *value)
>  {
>  	int v = git_parse_maybe_bool(value);
>  	if (v < 0)
> -		die_bad_bool(name, value);
> +		die(_("bad boolean config value '%s' for '%s'"), value, name);
>  	return v;
>  }
diff mbox series

Patch

diff --git a/config.c b/config.c
index 6428393a41..870d9534de 100644
--- a/config.c
+++ b/config.c
@@ -1180,20 +1180,6 @@  static void die_bad_number(const char *name, const char *value)
 	}
 }
 
-NORETURN
-static void die_bad_bool(const char *name, const char *value)
-{
-	if (!strcmp(name, "GIT_TEST_GETTEXT_POISON"))
-		/*
-		 * We explicitly *don't* use _() here since it would
-		 * cause an infinite loop with _() needing to call
-		 * use_gettext_poison().
-		 */
-		die("bad boolean config value '%s' for '%s'", value, name);
-	else
-		die(_("bad boolean config value '%s' for '%s'"), value, name);
-}
-
 int git_config_int(const char *name, const char *value)
 {
 	int ret;
@@ -1268,7 +1254,7 @@  int git_config_bool(const char *name, const char *value)
 {
 	int v = git_parse_maybe_bool(value);
 	if (v < 0)
-		die_bad_bool(name, value);
+		die(_("bad boolean config value '%s' for '%s'"), value, name);
 	return v;
 }