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

Re: [PATCH 1/2] blame.c: Add translation to warning about failed revision walk

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2014, 16:57 UTC
Message-ID
<xmqqppg563xl.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1407706406-30455-1-git-send-email-stefanbeller@gmail.com>
Stefan Beller <stefanbeller@gmail.com> writes:
> blame belonging to the group of
> ancillaryinterrogators and not to plumbinginterrogators
> should have localized error messages?

Unless running under --porcelain option to be driven by scripts, we expect that we are talking to a human user, so using "_(msg)" is very much appropriate for that case.

A possibly problematic script might do something like this:
	git blame --porcelain "$1" 2>&1 |
        awk "$awkScript"

and the $awkScript may check the input lines that do not match the expected pattern the output lines from the command follow and act on them, though. _(msg) is unwelcome to such a script [*1*].

I suspect the above problem is likely to be theoretical. People would be more sloppy and write this instead:

	git blame --porcelain "$1" |
        awk "$awkScript"

and let the problem pass unnoticed, affecting the later parts of their processing ;-). And "_(msg)", not "msg", would help.

[Footnote]

*1* ... and with possible interleaving of output that came to the standard output and the standard error, such parsing by $awkScript would not be a reliable way to do this anyway. A truly careful one has to be written along the lines of:

	git blame --porcelain "$1" >"$tmp" &&
        awk "$awkScript" <"$tmp"
anyway.
Show 18 quoted lines
> Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
> ---
>  builtin/blame.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 17d30d0..ca4ba6f 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -2700,7 +2700,7 @@ parse_done:
>  	 * uninteresting.
>  	 */
>  	if (prepare_revision_walk(&revs))
> -		die("revision walk setup failed");
> +		die(_("revision walk setup failed"));
>  
>  	if (is_null_sha1(sb.final->object.sha1)) {
>  		o = sb.final->util;
Previous: Stefan Beller
Message 5 of 5 in “blame.c: Add translation to warning about failed revision walk”
  1. 1/2 blame.c: Add translation to warning about failed revision walkStefan Beller, Aug 10, 2014
  2. 2/2 prepare_revision_walk: Check for return value in all placesStefan Beller, Aug 10, 2014
  3. Junio C HamanoAug 11, 2014
  4. Stefan BellerAug 11, 2014
  5. Junio C HamanoAug 12, 2014

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.