git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 5/6] i18n: factorize read-cache error messages

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 3, 2022, 22:29 UTC
Message-ID
<xmqqlewlu7gh.fsf@gitster.g>
In-Reply-To
<1888778902aa1d0d2cf118cfb7fe4b2e407953c6.1648915853.git.gitgitgadget@gmail.com>
"Jean-Noël Avila via GitGitGadget"  <gitgitgadget@gmail.com> writes:
Show 21 quoted lines
> From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr>
>
> Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
> ---
>  read-cache.c     | 8 ++++----
>  t/t1600-index.sh | 6 +++---
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index 1ad56d02e1d..639765e8ff1 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -1735,8 +1735,8 @@ static unsigned int get_index_format_default(struct repository *r)
>  		if (r->settings.index_version >= 0)
>  			version = r->settings.index_version;
>  		if (version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) {
> -			warning(_("index.version set, but the value is invalid.\n"
> -				  "Using version %i"), INDEX_FORMAT_DEFAULT);
> +			warning(_("'%s' set, but the value is invalid.\n"
> +				  "Using version %i"), "index.version", INDEX_FORMAT_DEFAULT);
>  			return INDEX_FORMAT_DEFAULT;

Not the focus of this patch, which (I am guessing without the log message) is to prevent translators from touching the constant 'index.version' by mistake, but I wonder if the message is helpful to users. When I see such a warning, how would I figure out what to fix so that I do not have to see the same warning again?

We should somehow at least hint that we are talking about an entry in .git/config file (or it may be coming ~/.gitconfig by mistake, in which case telling where we see a funny version string does help the user even more).

At least, telling that index.version is a configuration variable may nudge the user in the right direction, or is it too obvious and everybody who touches Git instinctively know when told that their qfwfq.zfzfz is set to an incorrect value, we are referring to their configuration variable? I dunno.

Show 8 quoted lines
> @@ -1745,8 +1745,8 @@ static unsigned int get_index_format_default(struct repository *r)
>  	version = strtoul(envversion, &endp, 10);
>  	if (*endp ||
>  	    version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) {
> -		warning(_("GIT_INDEX_VERSION set, but the value is invalid.\n"
> -			  "Using version %i"), INDEX_FORMAT_DEFAULT);
> +		warning(_("'%s' set, but the value is invalid.\n"
> +			  "Using version %i"), "GIT_INDEX_VERSION", INDEX_FORMAT_DEFAULT);
Likewise, but this is for an envirionment variable.
	The environment variable '%s' set, but the value is invalid.

may be overkill and more importantly makes it impossible to reuse the previous message, but the latter may be an improvement. configuration and environment variables may have different gramatical gender or something, perhaps.

Previous: Jean-Noël Avila via GitGitGadgetNext: Jean-Noël Avila via GitGitGadget
Message 23 of 28 in “More i18n fixes”
  1. 0/7 More i18n fixesJean-Noël Avila via GitGitGadget, Mar 20, 2022
  2. 1/7 i18n: factorize generic failure messagesJean-Noël Avila via GitGitGadget, Mar 20, 2022
  3. 2/7 sequencer: factor GIT_AUTHOR_* from message stringsBagas Sanjaya via GitGitGadget, Mar 20, 2022
  4. Bagas SanjayaMar 21, 2022
  5. 3/7 i18n: factorize "bad argument" messagesJean-Noël Avila via GitGitGadget, Mar 20, 2022
  6. 4/7 i18n: factorize "Server does not support foo" messagesJean-Noël Avila via GitGitGadget, Mar 20, 2022
  7. 5/7 i18n: factorize "foo does not take arguments" messagesJean-Noël Avila via GitGitGadget, Mar 20, 2022
  8. 7/7 i18n: factorize unrecognized options arguments messagesJean-Noël Avila via GitGitGadget, Mar 20, 2022
  9. 6/7 i18n: factorize read-cache error messagesJean-Noël Avila via GitGitGadget, Mar 20, 2022
  10. Johannes SixtMar 21, 2022
  11. Ævar Arnfjörð BjarmasonMar 21, 2022
  12. Junio C HamanoMar 21, 2022
  13. Jean-Noël AVILAMar 21, 2022
  14. Jean-Noël AVILAMar 21, 2022
  15. 0/6 More i18n fixesJean-Noël Avila via GitGitGadget, Apr 2, 2022
  16. 1/6 i18n: factorize generic failure messagesJean-Noël Avila via GitGitGadget, Apr 2, 2022
  17. Bagas SanjayaApr 3, 2022
  18. Ævar Arnfjörð BjarmasonApr 3, 2022
  19. Ævar Arnfjörð BjarmasonApr 3, 2022
  20. 3/6 i18n: factorize server support messages in fetch-packJean-Noël Avila via GitGitGadget, Apr 2, 2022
  21. 2/6 sequencer: factor GIT_AUTHOR_* from message stringsBagas Sanjaya via GitGitGadget, Apr 2, 2022
  22. 5/6 i18n: factorize read-cache error messagesJean-Noël Avila via GitGitGadget, Apr 2, 2022
  23. Junio C HamanoApr 3, 2022
  24. 4/6 i18n: factorize "foo does not take arguments" messagesJean-Noël Avila via GitGitGadget, Apr 2, 2022
  25. Ævar Arnfjörð BjarmasonApr 3, 2022
  26. Junio C HamanoApr 3, 2022
  27. 6/6 i18n: factorize "bad argument" messagesJean-Noël Avila via GitGitGadget, Apr 2, 2022
  28. Ævar Arnfjörð BjarmasonApr 3, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.