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

Re: [PATCH] commit encoding: store it in commit header rather than mucking with NUL

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 25, 2006, 00:41 UTC
Message-ID
<Pine.LNX.4.63.0612250134040.19693@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7v3b74q1c9.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sun, 24 Dec 2006, Junio C Hamano wrote:
> Thanks for paying a very close attention to what is in 'pu'.
You're welcome ;-)
>  - I did not want to break existing git implementations, but
>    hadn't audited the commit header parsers to see if they do
>    not get upset when they see unrecognized header fields in
>    commit objects.

I did not really audit it, but am quite sure that only parse_commit() really walks the buffer, and even this function just ignores what comes after committer. But if I read the code correctly, then the mandatory headers ("tree parent* author committer") have to come first, in that order.

>  - I was not sure if the "assume the whole commit->buffer is in
>    the local encoding and recode it into UTF-8" is correct.

For the purpose of showing it, there is no point in using two different encodings. I am not aware of any terminal (and do not own such a terminal anyway) which can display text with parts encoded differently from the rest.

Show 14 quoted lines
>  - Existing Porcelains such as gitk know i18n.commitencoding is
>    a hint to them by the core, and expect the core to give them
>    output in the local encoding.  With the change, the core
>    feeds UTF-8 to the caller, unless the Porcelain gets the log
>    with plumbing "cat-file".  This means they either have to
>    lose code to do their own recoding (which is probably a good
>    thing in the long run), or we would need to have a flag for
>    them to tell the core not to do the conversion.  But a new
>    flag to ask for older behaviour is always a wrong way of
>    transitioning across backward incompatibility.
> 
>    I think the output conversion from the log should be more
>    explicitly asked for it, than just a mere configuration
>    variable that cannot be overriden by gitk and friends.

Probably a new flag "--encoding" to log, which sets git_commit_encoding. And the function you introduced should probably not blindly convert to UTF-8, but to the current git_commit_encoding.

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 6 in “Re: i18n.logToUTF8: convert commit log message to UTF-8”
  1. Johannes SchindelinDec 24, 2006
  2. commit encoding: store it in commit header rather than mucking with NULJohannes Schindelin, Dec 24, 2006
  3. Junio C HamanoDec 25, 2006
  4. Johannes SchindelinDec 25, 2006
  5. Junio C HamanoDec 25, 2006
  6. Jakub NarebskiDec 25, 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.