git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sandy Carter <sandy.carter@savoirfairelinux.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Raphael Hertzog" <hertzog@debian.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>
Subject: Re: [PATCH] wt-status: i18n of section labels
Date: Wed, 12 Mar 2014 16:17:33 -0400	[thread overview]
Message-ID: <5320C0DD.1090803@savoirfairelinux.com> (raw)
In-Reply-To: <xmqq1ty7kwfp.fsf@gitster.dls.corp.google.com>

Le 2014-03-12 16:12, Junio C Hamano a écrit :
> Sandy Carter <sandy.carter@savoirfairelinux.com> writes:
>
>> Le 2014-03-12 15:22, Junio C Hamano a écrit :
>>>    static const char *wt_status_diff_status_string(int status)
>>>    {
>>>    	switch (status) {
>>>    	case DIFF_STATUS_ADDED:
>>> -		return _("new file");
>>> +		return _("new file:");
>>>    	case DIFF_STATUS_COPIED:
>>> -		return _("copied");
>>> +		return _("copied:");
>>>    	case DIFF_STATUS_DELETED:
>>> -		return _("deleted");
>>> +		return _("deleted:");
>>>    	case DIFF_STATUS_MODIFIED:
>>> -		return _("modified");
>>> +		return _("modified:");
>>>    	case DIFF_STATUS_RENAMED:
>>> -		return _("renamed");
>>> +		return _("renamed:");
>>>    	case DIFF_STATUS_TYPE_CHANGED:
>>> -		return _("typechange");
>>> +		return _("typechange:");
>>>    	case DIFF_STATUS_UNKNOWN:
>>> -		return _("unknown");
>>> +		return _("unknown:");
>>>    	case DIFF_STATUS_UNMERGED:
>>> -		return _("unmerged");
>>> +		return _("unmerged:");
>>>    	default:
>>> -		return NULL;
>>> +		return _("bug");
>>> +	}
>>> +}
>>
>> I don't see why _("bug") is returned when, later down,
>
> When there is a bug in the caller.
>
>>
>>> @@ -305,21 +346,16 @@ static void wt_status_print_change_data(struct wt_status *s,
>>>    	struct strbuf onebuf = STRBUF_INIT, twobuf = STRBUF_INIT;
>>>    	struct strbuf extra = STRBUF_INIT;
>>>    	static char *padding;
>>> +	static int label_width;
>>>    	const char *what;
>>>    	int len;
>>>
>>>    	if (!padding) {
>>> -		int width = 0;
>>> -		/* If DIFF_STATUS_* uses outside this range, we're in trouble */
>>> -		for (status = 'A'; status <= 'Z'; status++) {
>>> -			what = wt_status_diff_status_string(status);
>>> -			len = what ? strlen(what) : 0;
>>
>> checks for NULL.
>
> That extra NULL-ness check can go, I think.  Thanks for
> double-checking.
>

I refered to the wrong lines, the ones I was refering to were:

 > +static int maxwidth(const char *(*label)(int), int minval, int maxval)
 > +{
 > +	int result = 0, i;
 > +
 > +	for (i = minval; i <= maxval; i++) {
 > +		const char *s = label(i);
 > +		int len = s ? utf8_strwidth(s) : 0;

Sorry about that

  reply	other threads:[~2014-03-12 20:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20131008085036.11434.25160.reportbug@x230-buxy.home.ouaza.com>
     [not found] ` <20131219104613.GA18379@x230-buxy.home.ouaza.com>
2013-12-19 19:43   ` git: problematic git status output with some translations (such as fr_FR) Jonathan Nieder
2013-12-19 20:46     ` Junio C Hamano
2013-12-19 20:50       ` Jonathan Nieder
2013-12-19 23:59         ` Duy Nguyen
2014-01-16 22:00           ` Raphael Hertzog
2014-02-08  9:51         ` Duy Nguyen
2014-03-12 18:53     ` Junio C Hamano
2014-03-12 19:22       ` [PATCH] wt-status: i18n of section labels Junio C Hamano
2014-03-12 20:05         ` Sandy Carter
2014-03-12 20:12           ` Junio C Hamano
2014-03-12 20:17             ` Sandy Carter [this message]
2014-03-13 18:01               ` Junio C Hamano

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=5320C0DD.1090803@savoirfairelinux.com \
    --to=sandy.carter@savoirfairelinux.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hertzog@debian.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).