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

Re: [PATCH] wt-status: i18n of section labels

From
Sandy Carter <sandy.carter@savoirfairelinux.com>
Date
Mar 12, 2014, 20:17 UTC
Message-ID
<5320C0DD.1090803@savoirfairelinux.com>
In-Reply-To
<xmqq1ty7kwfp.fsf@gitster.dls.corp.google.com>
Le 2014-03-12 16:12, Junio C Hamano a écrit :
Show 61 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 12 in “Re: git: problematic git status output with some translations (such as fr_FR)”
  1. Jonathan NiederDec 19, 2013
  2. Junio C HamanoDec 19, 2013
  3. Jonathan NiederDec 19, 2013
  4. Duy NguyenDec 19, 2013
  5. Raphael HertzogJan 16, 2014
  6. Duy NguyenFeb 8, 2014
  7. Junio C HamanoMar 12, 2014
  8. wt-status: i18n of section labelsJunio C Hamano, Mar 12, 2014
  9. Sandy CarterMar 12, 2014
  10. Junio C HamanoMar 12, 2014
  11. Sandy CarterMar 12, 2014
  12. Junio C HamanoMar 13, 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.