public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Stefan Beller <stefanbeller@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 1/2] blame.c: Add translation to warning about failed revision walk
Date: Tue, 12 Aug 2014 09:57:58 -0700	[thread overview]
Message-ID: <xmqqppg563xl.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1407706406-30455-1-git-send-email-stefanbeller@gmail.com> (Stefan Beller's message of "Sun, 10 Aug 2014 23:33:25 +0200")

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.

> 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;

      parent reply	other threads:[~2014-08-12 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-10 21:33 [PATCH 1/2] blame.c: Add translation to warning about failed revision walk Stefan Beller
2014-08-10 21:33 ` [PATCH 2/2] prepare_revision_walk: Check for return value in all places Stefan Beller
2014-08-11 19:09   ` Junio C Hamano
2014-08-11 19:23     ` Stefan Beller
2014-08-12 16:57 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqppg563xl.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=stefanbeller@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox