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

Re: [PATCH (GITK)] gitk: Fix commit encoding support.

From
Alexander Gavrilov <angavrilov@gmail.com>
Date
Nov 10, 2008, 12:06 UTC
Message-ID
<bb6f213e0811100406l2fcde5b8k8772360947b948fd@mail.gmail.com>
In-Reply-To
<18712.7942.767651.569321@cargo.ozlabs.ibm.com>
On Mon, Nov 10, 2008 at 2:46 PM, Paul Mackerras <paulus@samba.org> wrote:
Show 15 quoted lines
> Alexander Gavrilov writes:
>
>> +proc do_readcommit {id} {
>> +    global tclencoding
>> +
>> +    # Invoke git-log to handle automatic encoding conversion
>> +    set fd [open [concat | git log --no-color --pretty=raw -1 $id] r]
>> +    # Read the results using i18n.logoutputencoding
>> +    fconfigure $fd -translation lf -eofchar {}
>> +    if {$tclencoding != {}} {
>> +     fconfigure $fd -encoding $tclencoding
>
> Does this mean there are two conversions going on, one inside git log
> and another inside Tcl?  Is there a reason why it's better to do two
> conversions than one, or is it just more convenient that way?
That makes the processing flow uniform with the usual code path.
> Would an alternative approach have been to read the output of git
> cat-file with -translation binary, look for an encoding header, and do
> an encoding convertfrom based on the encoding header?  What would be
> the disadvantage of such an approach?

If all commits were loaded through cat-file, that would be the way to go. Otherwise, when one code path uses one method of conversion, and another one, which is used rarely and semi-randomly, a different method, it may lead to confusing results if something goes slightly wrong.

Alexander
Previous: Paul MackerrasNext: Paul Mackerras
Message 3 of 4 in “gitk: Fix commit encoding support.”
  1. gitk: Fix commit encoding support.Alexander Gavrilov, Nov 9, 2008
  2. Paul MackerrasNov 10, 2008
  3. Alexander GavrilovNov 10, 2008
  4. Paul MackerrasNov 13, 2008

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.