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

Re: [PATCH v2] builtin/*: fix error message usage typo

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 14, 2023, 22:13 UTC
Message-ID
<xmqqa61f521c.fsf@gitster.g>
In-Reply-To
<20230214215403.1450903-1-cheskaqiqi@gmail.com>
Shuqi Liang <cheskaqiqi@gmail.com> writes:
Show 8 quoted lines
>  builtin/merge-base.c        |  6 +++---
>  	if (get_oid(arg, &revkey))
> -		die("Not a valid object name %s", arg);
> +		die("not a valid object name %s", arg);
>  	r = lookup_commit_reference(the_repository, &revkey);
>  	if (!r)
> -		die("Not a valid commit name %s", arg);
> +		die("not a valid commit name %s", arg);
You picked a rather unfortunate one.
    $ git grep -E -e 'Not a valid (object|commit) name ' '*.c'
    bisect.c:		die(_("Not a valid commit name %s"), oid_to_hex(oid));
    builtin/cat-file.c:		die("Not a valid object name %s", obj_name);
    builtin/cat-file.c:			die("Not a valid object name %s", obj_name);
    builtin/describe.c:		die(_("Not a valid object name %s"), arg);
    builtin/ls-tree.c:		die("Not a valid object name %s", argv[0]);
    builtin/merge-base.c:		die("Not a valid object name %s", arg);
    builtin/merge-base.c:		die("Not a valid commit name %s", arg);
    builtin/read-tree.c:			die("Not a valid object name %s", arg);
    builtin/unpack-file.c:		die("Not a valid object name %s", argv[1]);

Updating only one file would mean you leave two variants each for the same message, making the messages less consistent and adding more strings for translators to translate. If we were to do this, it probably makes sense to fix these (or just "valid object name" ones) as a single group in a patch (with updates to tests that expect the old spelling).

    Subject: [PATCH] errors: downcase "Not a valid object name"
    There are many instances of "Not a valid object name %s" given
    to die(), which should start with lowercase "not a valid ...".
    Fix them.

or something, which would touch the grep hits we see above, plus some tests in these files

    $ git grep -l -e 'Not a valid object name ' t/
    t/t1006-cat-file.sh
    t/t8007-cat-file-textconv.sh
that seem to expect "Not a valid object name", starting in capital.
Previous: Shuqi Liang
Message 5 of 5 in “builtin/clean.c: fix error message usage typo”
  1. Shuqi LiangFeb 14, 2023
  2. Junio C HamanoFeb 14, 2023
  3. Shuqi LiangFeb 14, 2023
  4. builtin/*: fix error message usage typoShuqi Liang, Feb 14, 2023
  5. Junio C HamanoFeb 14, 2023

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.