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

Re: Giving command line parameter to textconv command?

From
Jeff King <peff@peff.net>
Date
Dec 15, 2009, 17:03 UTC
Message-ID
<20091215170321.GB21322@coredump.intra.peff.net>
In-Reply-To
<7vvdg9ceud.fsf@alter.siamese.dyndns.org>
On Mon, Dec 14, 2009 at 03:31:38PM -0800, Junio C Hamano wrote:
Show 16 quoted lines
> The change to do so looks like this; it has a few side effects:
> 
>  - If somebody else were relying on the fact that 'nkf -w' names the
>    entire command, it now will run 'nkf' command with '-w' as an argument,
>    and it will break such a set-up.  IOW, command that has an IFS white
>    space in its path will now need to be quoted from the shell.
> 
>    You can see the fallout from this in the damage made to t/ hierarchy in
>    the attached patch.
> 
>  - You can now use $HOME and other environment variables your shell
>    expands when defining your textconv command.
> 
> Overall I think it is a good direction to go, but we need to be careful
> about how we transition the existing repositories that use the old
> semantics.

I agree that this is a good change. My only reservation would be that spawning a shell would be slightly slower (think "git log -p"). However:

  1. textconv is dog-slow already, as it has to dump each blob to a
     tempfile[1].
  2. There is an obvious optimization, which is that you can skip the
     shell if there are no metacharacters (in fact, we seem to be doing
     that already in launch_editor).
> We might need to introduce diff.*.xtextconv or something.

I am torn on this. I don't like introducing behavior changes that might hurt people (and really, I think we are just talking about people with textconv pointing to a program by its full path that has a space in it). But I also hate carrying around baggage crap like xtextconv forever. It makes git harder to explain why there are two variables that do almost the same thing, and the one they want to use is probably the one with the crappier, unlikely-to-be-guessed name.

So I am somewhat inclined to call it a bug fix, but I don't feel very strongly.

-Peff

[1] The current textconv interface is really nice for things like just using "antiword" out of the box. But I wrote a new interface which can be much faster: it calls the textconv filter with the blob name, and then the filter is responsible for using cat-file to get at the blob. This means the filter can look at only part of a blob (e.g., if we are interested in the metadata tags at the beginning of a large media file), and it can cache answers as it sees fit, avoiding access to the blob entirely.

I need to polish the code a bit and submit it. Obviously this is not meant to replace the existing textconv, but rather to supplement it, for when "fast and inconvenient" is better than "slow and simple". What is the best way to configure this? I can imagine "diff.*.textconvType = fast", or also "diff.*.fastTextconv".

-Peff
Previous: Jeff KingNext: Junio C Hamano
Message 8 of 33 in “Giving command line parameter to textconv command?”
  1. Nanako ShiraishiDec 14, 2009
  2. Junio C HamanoDec 14, 2009
  3. Nanako ShiraishiDec 15, 2009
  4. Junio C HamanoDec 15, 2009
  5. Jeff KingDec 15, 2009
  6. Junio C HamanoDec 16, 2009
  7. Jeff KingDec 16, 2009
  8. Jeff KingDec 15, 2009
  9. Junio C HamanoDec 15, 2009
  10. Nanako ShiraishiDec 30, 2009
  11. Junio C HamanoDec 30, 2009
  12. Jeff KingDec 30, 2009
  13. 1/6 run-command: add "use shell" optionJeff King, Dec 30, 2009
  14. Erik Faye-LundDec 30, 2009
  15. Johannes SixtJan 1, 2010
  16. 2/6 run-command: convert simple callsites to use_shellJeff King, Dec 30, 2009
  17. 3/6 run-command: optimize out useless shell callsJeff King, Dec 30, 2009
  18. Johannes SixtDec 31, 2009
  19. Junio C HamanoDec 31, 2009
  20. Johannes SixtDec 31, 2009
  21. Jeff KingDec 31, 2009
  22. Johannes SixtDec 31, 2009
  23. Jeff KingJan 1, 2010
  24. Johannes SixtJan 1, 2010
  25. 4/6 editor: use run_command's shell featureJeff King, Dec 30, 2009
  26. 5/6 textconv: use shell to run helperJeff King, Dec 30, 2009
  27. 6/6 diff: run external diff helper with shellJeff King, Dec 30, 2009
  28. 7/6 t0021: use $SHELL_PATH for the filter scriptJohannes Sixt, Jan 1, 2010
  29. 8/6 t4030, t4031: work around bogus MSYS bash path conversionJohannes Sixt, Jan 1, 2010
  30. Jeff KingJan 3, 2010
  31. Johannes SixtJan 4, 2010
  32. Jeff KingJan 4, 2010
  33. Johannes SixtJan 4, 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.