public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
Cc: git@vger•kernel.org, ghostanarky@gmail•com
Subject: Re: [PATCH] status: disable translation when --porcelain is used
Date: Fri, 21 Mar 2014 10:38:14 -0700	[thread overview]
Message-ID: <xmqqd2hfv4e1.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <vpqior8dke6.fsf@anie.imag.fr> (Matthieu Moy's message of "Fri, 21 Mar 2014 09:29:53 +0100")

Matthieu Moy <Matthieu.Moy@grenoble-inp•fr> writes:

> Junio C Hamano <gitster@pobox•com> writes:
>
>>> diff --git a/wt-status.c b/wt-status.c
>>> index a452407..e55e5b9 100644
>>> --- a/wt-status.c
>>> +++ b/wt-status.c
>>> @@ -1509,19 +1509,23 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
>>>  		return;
>>>  	}
>>>  
>>> +	const char *gone   = s->no_gettext ? "gone"   : _("gone");
>>> +	const char *behind = s->no_gettext ? "behind " : _("behind ");
>>> +	const char *ahead  = s->no_gettext ? "ahead "  : _("ahead ");
>>
>> Having to repeat the same string constant twice (and a half for the
>> variable name) each is an eyesore.  I wonder if we can do better,
>> perhaps with:
>>
>> #define LABEL(string) (s->no_gettext ? (string) : _(string))
>>
>> and then
>>
>> 	color_fprintf(s->fp, header_color, LABEL(N_("gone")));
>>
>> or something along those lines?
>
> I first thought about trying something clever with the preprocessor, but
> since it's only for 3 strings, I went the KISS way. I tend to prefer my
> version for simplicity, but no strong opinion here.

Then I'll squash 61bf9709 (SQUASH??? fix decl-after-stmt and
simplify, 2014-03-20) in before merging the patch to 'next'.

      reply	other threads:[~2014-03-21 17:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 10:31 Bug? git status --porcelain --branch is translated Anarky
2014-03-20 12:12 ` [PATCH] status: disable translation when --porcelain is used Matthieu Moy
2014-03-20 17:47   ` Junio C Hamano
2014-03-21  8:29     ` Matthieu Moy
2014-03-21 17:38       ` 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=xmqqd2hfv4e1.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Matthieu.Moy@grenoble-inp$(echo .)fr \
    --cc=ghostanarky@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /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