git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] config: improve error message for boolean config
@ 2020-09-18  2:17 Andrew Klotz via GitGitGadget
  2020-09-18  2:17 ` [PATCH 1/2] " Andrew Klotz via GitGitGadget
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Andrew Klotz via GitGitGadget @ 2020-09-18  2:17 UTC (permalink / raw)
  To: git; +Cc: Andrew Klotz

Currently invalid boolean config values return messages about 'bad numeric',
which I found misleading when the error was due to a boolean string value.
This change makes the error message reflect the boolean value.

The current approach relies on GIT_TEST_GETTEXT_POISON being a boolean
value, moving its special case out fromdie_bad_number() and into 
git_config_bool_or_int(). An alternative could be for die_bad_number() to
handle boolean values when erroring, although the function name might need
to change if it is handling non-numeric values.

Signed-off-by: Andrew Klotz agc.klotz@gmail.com [agc.klotz@gmail.com]

Andrew Klotz (2):
  config: improve error message for boolean config
  formatting for error messages

 config.c                  | 26 ++++++++++++++------------
 t/t0205-gettext-poison.sh |  2 +-
 2 files changed, 15 insertions(+), 13 deletions(-)


base-commit: 3a238e539bcdfe3f9eb5010fd218640c1b499f7a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-841%2FKlotzAndrew%2Fbetter_bool_errors-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-841/KlotzAndrew/better_bool_errors-v1
Pull-Request: https://github.com/git/git/pull/841
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] config: improve error message for boolean config
@ 2021-01-23 23:15 Andrew Klotz
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Klotz @ 2021-01-23 23:15 UTC (permalink / raw)
  To: gitster; +Cc: phillip.wood123, peff, gitgitgadget, git, agc.klotz

Thanks for the feedback,

I updated the branch and moved:

  - boolean error message change out of git_config_bool_or_int to just 
in git_config_bool

  - added die_bad_boolean instead of modifying die_bad_number.

The advantage here is we only use a bool error message when we know the 
value
is a bool. Is this more along the lines of the suggestion?


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-02-12 19:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  2:17 [PATCH 0/2] config: improve error message for boolean config Andrew Klotz via GitGitGadget
2020-09-18  2:17 ` [PATCH 1/2] " Andrew Klotz via GitGitGadget
2020-09-18 18:10   ` Jeff King
2020-09-18 18:30   ` Phillip Wood
2020-09-18 19:14     ` Junio C Hamano
2020-09-18  2:17 ` [PATCH 2/2] formatting for error messages Andrew Klotz via GitGitGadget
2020-09-18 17:22 ` [PATCH 0/2] config: improve error message for boolean config Junio C Hamano
2021-02-09  1:25 ` [PATCH v2] " Andrew Klotz via GitGitGadget
2021-02-09 16:51   ` Jeff King
2021-02-09 21:02     ` Junio C Hamano
2021-02-11 20:30   ` [PATCH v3] " Andrew Klotz via GitGitGadget
2021-02-12 10:38     ` Jeff King
2021-02-12 19:52       ` Junio C Hamano
2021-01-23 23:15 [PATCH 1/2] " Andrew Klotz

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).