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

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

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Aug 6, 2010, 08:51 UTC
Message-ID
<vpqaap0cees.fsf@bauges.imag.fr>
In-Reply-To
<87aap0sljs.fsf@fox.patthoyts.tk>
Pat Thoyts <patthoyts@users.sourceforge.net> writes:
Show 31 quoted lines
>> 	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]
>                 }

I'm not very fluent in Tcl, but I don't think this runs the command through a shell (pstree agrees with me). That will work in most cases, so that may be acceptable, but if you want to have full compatibility with what "git blame" does (by using a shell) and allow e.g.

textconv = LANG=C some-command
or
textconv = cd ../; do-whatever

which are already managed by "git blame" and are OK with my version, it's not going to do it.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Pat ThoytsNext: Pat Thoyts
Message 6 of 9 in “[BUG] git gui blame fails for multi-word textconv filter”
  1. Kirill SmelkovAug 4, 2010
  2. Clément PoulainAug 4, 2010
  3. Matthieu MoyAug 5, 2010
  4. git-gui: Use shell to launch textconv filter in "blame"Matthieu Moy, Aug 5, 2010
  5. Pat ThoytsAug 5, 2010
  6. Matthieu MoyAug 6, 2010
  7. Pat ThoytsAug 6, 2010
  8. Pat ThoytsAug 5, 2010
  9. Kirill SmelkovAug 19, 2010

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.