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

Re: [PATCHv3 3/7] show: honor --textconv for blobs

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 13, 2013, 14:57 UTC
Message-ID
<5190FF73.1080606@drmicha.warpmail.net>
In-Reply-To
<20130513115451.GA3903@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 13.05.2013 13:55:
Show 41 quoted lines
> On Sun, May 12, 2013 at 10:01:38PM -0700, Junio C Hamano wrote:
> 
>> Michael J Gruber <git@drmicha.warpmail.net> writes:
>>
>>> Adding to that:
>>>
>>> Somehow I still feel I should introduce a new attribute "show" (or a
>>> better name) similar to "diff" so that you can specifiy a diff driver to
>>> use for showing a blob (or grepping it), which may or may not be the
>>> same you use for "diff". This would be a much more fine-grained and
>>> systematic way of setting a default for "--textconv" for blobs.
>>>
>>> Of course, some driver attributes would just not matter for coverting
>>> blobs, but that doesn't hurt.
>>>
>>> I'm just wondering whether it's worth the effort and whether I should
>>> distinguish between "show" and grep".
>>
>> Haven't thought things through, but my gut feeling is that it is on
>> the other side of the line. We could of course add more features and
>> over-engineered mechanisms, and the implementation may end up to be
>> even modular and clean, but I cannot answer "Yes" with a confidence
>> to the question "Does such a fine grained control help the users?"
>> and cannot answer "If so in what way?" myself.
> 
> Yeah, I think the _most_ flexible thing is going to look something like:
> 
>   $ cat .gitattributes
>   *.pdf diff=pdf show=pdf
> 
>   $ cat ~/.gitconfig
>   [diff "pdf"]
>           textconv = ...
>   [show "pdf"]
>           textconv = ...
> 
> But that obviously sucks, because in the common case that you want to
> use the same command, you are repeating yourself in the config. You
> could assume that the "show" attribute points us at a "diff" block. And
> that makes sense for textconv, but what does it mean if you have
> "show=foo" and "diff.foo.command" set?

I don't propose "show drivers". In your example above, you would point to the same diff driver.

If you use a diff driver just with the "show" attribute then only its textconv config will be relevant.

But you do have the possibility to use different drivers for diff and show. For example, for showing a file some sort of automatic pagination or line numbering can be helpful whereas it would hurt the diff case.

Show 15 quoted lines
> If the _only_ thing you would want to do with such a "show" mechanism is
> to display converted contents on show/grep, then we could lose the
> flexibility and say that "show" is a single-bit: do we respect diff
> textconv for show/grep in this case, or not? And that leaves only the
> question of where to put it: is it a gitattribute, or does it go in the
> config?
> 
> I don't think that it is a property of the file itself. That is, you do
> not say "foo files are inherently uninteresting to git-show, and
> therefore we always convert them, whereas bar files do not have that
> property'. You say "in my workflows, I expect to see converted results
> from grep/show". And the latter points to using config, like either
> "diff.*.showConverted" (to allow per-type setting), or even
> "grep.useTextconv" and "show.textConv" (to allow setting it per-user for
> all types).

I strongly disagree here. I have textconv filters for pdf, gpg, odf, xls, doc, xoj... I know, ugly. At least some of them would benefit from different filteres or different settings.

The way I propose it, a user would just have to add "show=foo" to the "diff=foo" lines without having to ad an extra filter, but with the flexibility to do so.

> And of course for any workflow-oriented config, you will sometimes want
> to override it for a particular operation. But that is why we have a
> command-line escape hatch, and that part is already implemented.

One may ask what a purely ui output oriented setting like "show" has to do in .gitattributes, of course, but that applies to "diff" as well. Separating the two (one in attributes, one in config) looks artificial to me.

Michael
Previous: Jeff KingNext: Junio C Hamano
Message 67 of 77 in “grep with textconv”
  1. 0/6 grep with textconvMichael J Gruber, Apr 19, 2013
  2. 1/6 t4030: demonstrate behavior of show with textconvMichael J Gruber, Apr 19, 2013
  3. Jeff KingApr 20, 2013
  4. Michael J GruberApr 20, 2013
  5. 2/6 show: obey --textconv for blobsMichael J Gruber, Apr 19, 2013
  6. Jeff KingApr 20, 2013
  7. Michael J GruberApr 20, 2013
  8. Jeff KingApr 21, 2013
  9. Michael J GruberApr 22, 2013
  10. Junio C HamanoApr 22, 2013
  11. Jeff KingApr 22, 2013
  12. Jeremy RosenApr 22, 2013
  13. Matthieu MoyApr 22, 2013
  14. Michael J GruberApr 23, 2013
  15. 3/6 cat-file: do not die on --textconv without textconv filtersMichael J Gruber, Apr 19, 2013
  16. Junio C HamanoApr 19, 2013
  17. Jeff KingApr 20, 2013
  18. Michael J GruberApr 20, 2013
  19. 4/6 t7008: demonstrate behavior of grep with textconvMichael J Gruber, Apr 19, 2013
  20. 5/6 grep: allow to use textconv filtersMichael J Gruber, Apr 19, 2013
  21. Jeff KingApr 20, 2013
  22. 6/6 grep: obey --textconv for the case rev:pathMichael J Gruber, Apr 19, 2013
  23. Jeff KingApr 20, 2013
  24. Michael J GruberApr 20, 2013
  25. Jeff KingApr 21, 2013
  26. Junio C HamanoApr 19, 2013
  27. Jeff KingApr 20, 2013
  28. Michael J GruberApr 20, 2013
  29. 0/7 grep with textconvMichael J Gruber, Apr 23, 2013
  30. 1/7 t4030: demonstrate behavior of show with textconvMichael J Gruber, Apr 23, 2013
  31. Junio C HamanoApr 23, 2013
  32. 2/7 show: obey --textconv for blobsMichael J Gruber, Apr 23, 2013
  33. Junio C HamanoApr 23, 2013
  34. Michael J GruberApr 24, 2013
  35. Junio C HamanoApr 24, 2013
  36. 3/7 cat-file: do not die on --textconv without textconv filtersMichael J Gruber, Apr 23, 2013
  37. Junio C HamanoApr 23, 2013
  38. 4/7 t7008: demonstrate behavior of grep with textconvMichael J Gruber, Apr 23, 2013
  39. Junio C HamanoApr 23, 2013
  40. Michael J GruberApr 24, 2013
  41. Junio C HamanoApr 24, 2013
  42. 5/7 grep: allow to use textconv filtersMichael J Gruber, Apr 23, 2013
  43. 6/7 grep: honor --textconv for the case rev:pathMichael J Gruber, Apr 23, 2013
  44. 7/7 git grep: honor textconv by defaultMichael J Gruber, Apr 23, 2013
  45. Junio C HamanoApr 23, 2013
  46. Michael J GruberApr 24, 2013
  47. Junio C HamanoApr 24, 2013
  48. Matthieu MoyApr 24, 2013
  49. Junio C HamanoApr 24, 2013
  50. Michael J GruberApr 26, 2013
  51. Matthieu MoyApr 26, 2013
  52. Michael J GruberApr 29, 2013
  53. Junio C HamanoApr 29, 2013
  54. 1/7 t4030: demonstrate behavior of show with textconvMichael J Gruber, May 10, 2013
  55. 2/7 diff_opt: track whether flags have been set explicitlyMichael J Gruber, May 10, 2013
  56. Eric SunshineMay 10, 2013
  57. 3/7 show: honor --textconv for blobsMichael J Gruber, May 10, 2013
  58. Junio C HamanoMay 10, 2013
  59. Jeff KingMay 10, 2013
  60. Junio C HamanoMay 10, 2013
  61. Jeff KingMay 11, 2013
  62. Junio C HamanoMay 11, 2013
  63. Michael J GruberMay 11, 2013
  64. Michael J GruberMay 11, 2013
  65. Junio C HamanoMay 13, 2013
  66. Jeff KingMay 13, 2013
  67. Michael J GruberMay 13, 2013
  68. Junio C HamanoMay 13, 2013
  69. Jeff KingMay 16, 2013
  70. Junio C HamanoMay 11, 2013
  71. Michael J GruberMay 12, 2013
  72. 4/7 cat-file: do not die on --textconv without textconv filtersMichael J Gruber, May 10, 2013
  73. 5/7 t7008: demonstrate behavior of grep with textconvMichael J Gruber, May 10, 2013
  74. 6/7 grep: allow to use textconv filtersMichael J Gruber, May 10, 2013
  75. 7/7 grep: honor --textconv for the case rev:pathMichael J Gruber, May 10, 2013
  76. Junio C HamanoMay 10, 2013
  77. Junio C HamanoMay 10, 2013

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.