git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pat Thoyts <patthoyts@users.sourceforge.net>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>,
	"Clemens Buchacher" <drizzd@aon.at>,
	"Clément Poulain" <clement.poulain@ensimag.imag.fr>,
	"Diane Gasselin" <diane.gasselin@ensimag.imag.fr>,
	"Axel Bonnet" <axel.bonnet@ensimag.imag.fr>
Subject: Re: [PATCH] git-gui: use textconv filter for diff and blame
Date: Fri, 30 Jul 2010 01:22:05 +0100	[thread overview]
Message-ID: <871valstsi.fsf@fox.patthoyts.tk> (raw)
In-Reply-To: <1280319830-20483-1-git-send-email-Matthieu.Moy@imag.fr> (Matthieu Moy's message of "Wed\, 28 Jul 2010 14\:23\:50 +0200")

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

>From: Clément Poulain <clement.poulain@ensimag.imag.fr>
>
>Create a checkbox "Use Textconv For Diffs and Blame" in git-gui options.
>If checked and if the driver for the concerned file exists, git-gui calls diff
>and blame with --textconv option
>
>Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
>Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
>Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
>Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
>---
>
>This patch was originally written by Clément Poulain (a student of
>mine), it was not mergeable at the time it was sent, since it relied
>on a patch serie introducing "git cat-file --textconv". Now that this
>cat-file --textconv is in a git release (1.7.2), I guess it's time to
>get this merged into git-gui.
>
>I did review and test the patch, but I'm mostly useless in TCL, so I
>may have missed the obvious. That said, the patch is relatively simple
>and looks OK.

This looks generally fine but can you suggest some test that I can use
to ensure it is actually doing something. I tried committing some test
files containing cyrillic characters but I see no difference between
using an unpatched git-gui and your patched version with git 1.7.2

>diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl
>index 786b50b..ead68fd 100644
>--- a/git-gui/lib/blame.tcl
>+++ b/git-gui/lib/blame.tcl
>@@ -449,11 +449,28 @@ method _load {jump} {
> 
> 	$status show [mc "Reading %s..." "$commit:[escape_path $path]"]
> 	$w_path conf -text [escape_path $path]
>+
>+	set do_textconv 0
>+	if {![is_config_false gui.textconv] && [git-version >= 1.7.2]} {
>+		set filter [gitattr $path diff set]
>+		set textconv [get_config [join [list diff $filter textconv] .]]
>+		if {$filter ne {set} && $textconv ne {}} {
>+			set do_textconv 1
>+		}
>+	}
> 	if {$commit eq {}} {
>-		set fd [open $path r]
>+		if {$do_textconv ne 0} {
>+			set fd [open "|$textconv $path" r]

This is better written as
  set fd [open |[list $textconv $path] r]
in case there are spaces in either of the two components.

>+		} else {
>+			set fd [open $path r]
>+		}
> 		fconfigure $fd -eofchar {}
> 	} else {
>-		set fd [git_read cat-file blob "$commit:$path"]
>+		if {$do_textconv ne 0} {
>+			set fd [git_read cat-file --textconv "$commit:$path"]
>+		} else {
>+			set fd [git_read cat-file blob "$commit:$path"]
>+		}
> 	}
> 	fconfigure $fd \
> 		-blocking 0 \

  reply	other threads:[~2010-07-30  0:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28 12:23 [PATCH] git-gui: use textconv filter for diff and blame Matthieu Moy
2010-07-30  0:22 ` Pat Thoyts [this message]
2010-07-30  6:56   ` Matthieu Moy
2010-07-30 10:30     ` Pat Thoyts
2010-07-30 10:40       ` Matthieu Moy
2010-08-02 19:01         ` Junio C Hamano

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=871valstsi.fsf@fox.patthoyts.tk \
    --to=patthoyts@users.sourceforge.net \
    --cc=Matthieu.Moy@imag.fr \
    --cc=axel.bonnet@ensimag.imag.fr \
    --cc=clement.poulain@ensimag.imag.fr \
    --cc=diane.gasselin@ensimag.imag.fr \
    --cc=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.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).