Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Klotz <agc.klotz@gmail.com>2021-02-11 23:30:53 +0300
committerJunio C Hamano <gitster@pobox.com>2021-02-12 00:44:55 +0300
commitf276e2a469430999ff7e3735ea7b41508ed1abd8 (patch)
treefc503d5c5161f8c78267e17aa16e9397c5d1f128 /t/t1300-config.sh
parent773e25afc41b1b6533fa9ae2cd825d0b4a697fad (diff)
config: improve error message for boolean config
Currently invalid boolean config values return messages about 'bad numeric', which is slightly misleading when the error was due to a boolean value. We can improve the developer experience by returning a boolean error message when we know the value is neither a bool text or int. before with an invalid boolean value of `non-boolean`, its unclear what numeric is referring to: fatal: bad numeric config value 'non-boolean' for 'commit.gpgsign': invalid unit now the error message mentions `non-boolean` is a bad boolean value: fatal: bad boolean config value 'non-boolean' for 'commit.gpgsign' Signed-off-by: Andrew Klotz <agc.klotz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1300-config.sh')
-rwxr-xr-xt/t1300-config.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 1a4156c704..d6fb9c1753 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -672,6 +672,13 @@ test_expect_success 'invalid unit' '
test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
'
+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
+'
+
test_expect_success 'line number is reported correctly' '
printf "[bool]\n\tvar\n" >invalid &&
test_must_fail git config -f invalid --path bool.var 2>actual &&