config: improve error message for boolean config
commitf276e2a469430999ff7e3735ea7b41508ed1abd8
authorAndrew Klotz <agc.klotz@gmail.com>
Thu, 11 Feb 2021 20:30:53 +0000 (11 20:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Feb 2021 21:44:55 +0000 (11 13:44 -0800)
treefc503d5c5161f8c78267e17aa16e9397c5d1f128
parent773e25afc41b1b6533fa9ae2cd825d0b4a697fad
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>
config.c
t/t1300-config.sh