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

Re: Best way to apply textconv to a working tree file

From
Jeff King <peff@peff.net>
Date
Jun 1, 2010, 17:04 UTC
Message-ID
<20100601170426.GC9702@sigill.intra.peff.net>
In-Reply-To
<a1ace6b77167a2ad4b4995e8c4d09761@ensimag.fr>
On Tue, Jun 01, 2010 at 03:41:05PM +0200, Clément Poulain wrote:
> We are wondering what is the best way to do the textconv. Here are some
> solutions we thought about:
One solution you didn't mention would be to do it all yourself:
  driver=`git check-attr diff "$file" | cut -d: -f3`
  textconv=`git config diff.$driver.textconv`
  $textconv <$file >$file.converted

This has the advantage of working with existing versions of git. The downside is that it's more code (e.g., my parsing above is quite sloppy and loose. Doing it right would be a few more lines).

Furthermore, it doesn't use the textconv cache at all. For working tree files, this might not matter (if you pull the sha1 out of the index, though, you can still check the cache, and unchanged working tree files are likely to be in the cache). But for blobs in general, the cache is worth using.

-Peff
Previous: Clément PoulainNext: Clément Poulain
Message 7 of 8 in “Best way to apply textconv to a working tree file”
  1. Clément PoulainJun 1, 2010
  2. Matthieu MoyJun 1, 2010
  3. Jeff KingJun 1, 2010
  4. Matthieu MoyJun 1, 2010
  5. Jeff KingJun 1, 2010
  6. Clément PoulainJun 2, 2010
  7. Jeff KingJun 1, 2010
  8. Clément PoulainJun 2, 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.