git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexander Gavrilov" <angavrilov@gmail.com>
To: "Paul Mackerras" <paulus@samba.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH (GITK)] gitk: Fix commit encoding support.
Date: Mon, 10 Nov 2008 15:06:39 +0300	[thread overview]
Message-ID: <bb6f213e0811100406l2fcde5b8k8772360947b948fd@mail.gmail.com> (raw)
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:
> 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

  reply	other threads:[~2008-11-10 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-09 15:06 [PATCH (GITK)] gitk: Fix commit encoding support Alexander Gavrilov
2008-11-10 11:46 ` Paul Mackerras
2008-11-10 12:06   ` Alexander Gavrilov [this message]
2008-11-13 11:42     ` Paul Mackerras

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=bb6f213e0811100406l2fcde5b8k8772360947b948fd@mail.gmail.com \
    --to=angavrilov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /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).