Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] git-gui: Use shell to launch textconv filter in "blame"

From: Pat Thoyts <hidden>
Date: 2016-06-15 22:49:15
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

Possibly related (same subject, not in this thread)

Matthieu Moy [off-list ref] writes:
This allows one to use textconv commands with arguments.

Signed-off-by: Matthieu Moy <redacted>
quoted hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help