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

Re: [PATCH] git-blame: Make the output human readable

From
Fredrik Kuivinen <freku045@student.liu.se>
Date
Mar 7, 2006, 16:34 UTC
Message-ID
<20060307163427.GB4457@c165.ib.student.liu.se>
In-Reply-To
<7vveuseg2u.fsf@assigned-by-dhcp.cox.net>
On Sun, Mar 05, 2006 at 01:28:57PM -0800, Junio C Hamano wrote:
Show 21 quoted lines
> Fredrik Kuivinen <freku045@student.liu.se> writes:
> 
> > I find the first format easier to read since everything is aligned (we
> > always output 15 characters for the committer's name padded with
> > spaces if necessary and the line numbers are padded appropriately). It
> > also takes up less space on screen since it doesn't use tabs.
> 
> Careful.  The convention for names is to encode them in UTF-8,
> so if you mean 15 "characters" that might be OK but if it can
> truncate in the middle of a multibyte sequence of UTF-8 encoded
> single character it is a no-no.
> 
> We are talking about "casual" aligning, so I would not bring up
> "proportional fonts", but even on a monospace terminal and
> line-printer output, there still is the issue of byte count not
> matching columns.  In an i18nized environment, aligning columns
> by counting bytes is a lost battle.
> 
> In any case, please make sure you do not chop a character in the
> middle at least [*1*].
> 

I hadn't thought of that. The code as it is now will occasionally do the wrong thing when encountered with multibyte per code point encodings. If we can assume that the name is in UTF-8 then the code posted by "linux@horizon.com" to the list should do the trick.

However, can we assume that the name is in UTF-8? Do i18n.commitencoding only apply to the commit message, or is it intended to apply to the author/committer information too?

I am beginning to think that it might be best to, by default, store the author, committer and commit messages in UTF-8. And then automatically convert from/to the users locale on input/output. (I just read the old "Rss produced by git is not valid xml?" thread where this issue was discussed quite a bit. However, I didn't see the 'store in UTF-8 by default and convert from/to users locale' method anywhere in that thread.)

- Fredrik
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 10 in “git-blame: Make the output human readable”
  1. git-blame: Make the output human readableFredrik Kuivinen, Mar 5, 2006
  2. Junio C HamanoMar 5, 2006
  3. Fredrik KuivinenMar 5, 2006
  4. Johannes SchindelinMar 5, 2006
  5. Junio C HamanoMar 5, 2006
  6. Fredrik KuivinenMar 7, 2006
  7. blame: avoid -lm by not using log().Junio C Hamano, Mar 5, 2006
  8. Johannes SchindelinMar 5, 2006
  9. blame and annotate: show localtime with timezone.Junio C Hamano, Mar 5, 2006
  10. Johannes SchindelinMar 5, 2006

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.