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>,
	"Kirill Smelkov" <kirr@landau.phys.spbu.ru>,
	"Clément Poulain" <clement.poulain@ensimag.imag.fr>
Subject: Re: [PATCH] git-gui: Use shell to launch textconv filter in "blame"
Date: Fri, 06 Aug 2010 00:10:31 +0100	[thread overview]
Message-ID: <87aap0sljs.fsf@fox.patthoyts.tk> (raw)
In-Reply-To: <1281002722-3042-1-git-send-email-Matthieu.Moy@imag.fr> (Matthieu Moy's message of "Thu, 5 Aug 2010 12:05:22 +0200")

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

>This allows one to use textconv commands with arguments.
>
>Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>

>diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl
>index 2137ec9..77656d3 100644
>--- a/git-gui/lib/blame.tcl
>+++ b/git-gui/lib/blame.tcl
>@@ -460,7 +460,9 @@ method _load {jump} {
> 	}
> 	if {$commit eq {}} {
> 		if {$do_textconv ne 0} {
>-			set fd [open |[list $textconv $path] r]
>+			# Run textconv with sh -c "..." to allow it to
>+			# contain command + arguments.
>+			set fd [open |[list [shellpath] -c "$textconv \"\$0\"" $path] r]
> 		} else {
> 			set fd [open $path r]
> 		}

I don't believe we need to put all this in to launch this via the
shell. We just have to pass a list where the first element is the
command-name.

The following works for me using your 'textconv = odf2txt --width=40'
test and also a 'textconv = od -t x1' that I tried for a hex dump
output. I couldn't make run-mailcap do anything useful for me.

diff --git a/lib/blame.tcl b/lib/blame.tcl
index 2137ec9..c06ef04 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -460,7 +460,7 @@ method _load {jump} {
        }
        if {$commit eq {}} {
                if {$do_textconv ne 0} {
-                       set fd [open |[list $textconv $path] r]
+                       set fd [open |[linsert $textconv end $path] r]
                } else {
                        set fd [open $path r]
                }

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

  reply	other threads:[~2010-08-05 23:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04 19:25 [BUG] git gui blame fails for multi-word textconv filter Kirill Smelkov
2010-08-04 23:46 ` Clément Poulain
2010-08-05  9:59   ` Matthieu Moy
2010-08-05 10:05     ` [PATCH] git-gui: Use shell to launch textconv filter in "blame" Matthieu Moy
2010-08-05 23:10       ` Pat Thoyts [this message]
2010-08-06  8:51         ` Matthieu Moy
2010-08-06 17:56           ` Pat Thoyts
2010-08-19  8:05           ` [BUG] git gui blame fails for multi-word textconv filter Kirill Smelkov
2010-08-05 22:58   ` Pat Thoyts

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=87aap0sljs.fsf@fox.patthoyts.tk \
    --to=patthoyts@users.sourceforge.net \
    --cc=Matthieu.Moy@imag.fr \
    --cc=clement.poulain@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    --cc=kirr@landau.phys.spbu.ru \
    --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).